diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45d611245..9512dd055 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/).
+## [ 1.3.7 ] - 2019-01-16
+### Added
+* Distribute plaintext URLs instead of full markup for automatic embeds (oEmbeds). This was causing issues for non-privileged users where the markup was subject to sanitization/kses.
+* Add `push`/`pull` context to `get_available_authorized_sites()`.
+* Add `dt_allowed_media_extensions` and `dt_media_processing_filename` filters so that different media types or specific files can be detected and targeted.
+
+### Fixed
+* Ensure media meta is passed through `prepare_meta()` to apply the blacklist. This completes the generated image size info fix from 1.3.3.
+* Avoid a PHP notice when only using the block editor on the receiving site.
+* Avoid a jQuery Migrate notice.
+
## [ 1.3.6 ] - 2018-12-19
### Fixed (for WP 5.0 block editor)
* Properly detect block editor content.
diff --git a/README.md b/README.md
index 18dd55a64..9ba919be8 100644
--- a/README.md
+++ b/README.md
@@ -61,8 +61,6 @@ In addition, in order for distribution to work with external connections that ha
__Backwards Compatibility__ - While we strive to be mindful of backwards compatibility much the same way WordPress itself is, we do not currently guarantee continued interoperability between different versions of Distributor. We assume the current userbase for this plugin has a high degree of control over any site that has been set up as an external connection and urge you to keep Distributor up to date.
-__oEmbeds__ - oEmbeds are currently distributed as fully-formed HTML which may not be retained correctly if a user without the `unfiltered_html` capability later edits the post. A fix for the issue is forthcoming; in the meantime, we recommend removing the `autoembed` filter from `the_content` when content is being prepared for distribution.
-
## Developers
### Testing
diff --git a/composer.json b/composer.json
index 092eba869..2e1c572e3 100644
--- a/composer.json
+++ b/composer.json
@@ -2,25 +2,25 @@
"name": "10up/distributor",
"type": "wordpress-plugin",
"authors": [
- {
- "name": "Taylor Lovett",
- "email": "taylor.lovett@10up.com"
- }
+ {
+ "name": "Taylor Lovett",
+ "email": "taylor.lovett@10up.com"
+ }
],
"require": {
- "php": ">=5.6",
+ "php": ">=5.6",
"yahnis-elsts/plugin-update-checker": "^4.4"
},
"autoload": {
- "psr-4": {
- "Distributor\\": "includes/classes/"
- }
+ "psr-4": {
+ "Distributor\\": "includes/classes/"
+ }
},
"require-dev": {
"10up/wp_mock": "dev-dev",
"10up/phpcs-composer": "dev-master",
"phpunit/phpunit": "^6.5",
- "10up/wpassure": "~0.9"
+ "10up/wpacceptance": "~0.10.0"
},
"scripts": {
"lint": "phpcs .",
diff --git a/dist/js/admin-distributed-post.min.js.map b/dist/js/admin-distributed-post.min.js.map
index 27af97419..8800f64c7 100644
--- a/dist/js/admin-distributed-post.min.js.map
+++ b/dist/js/admin-distributed-post.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///admin-distributed-post.min.js","webpack:///webpack/bootstrap ebbc74364e6cc6835171","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-distributed-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","0","jQuery","5","_jquery","_jquery2","obj","default","openLinks","document","querySelectorAll","helpLink","getElementById","distributorTab","querySelector","length","on","click"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YGvEA,KAAM,GANN8B,GAAA9B,EAAA,GHkFI+B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIZ,WAAaY,GAAQC,QAASD,IAFjDF,GGhFhCI,EAAiBC,SAASC,iBAAkB,0BAC5CC,EAAiBF,SAASG,eAAgB,wBAC1CC,EAAiBJ,SAASK,cAAe,2BAErCnC,EAAI,EAAGA,EAAI6B,EAAUO,OAAQpC,KACtC,EAAA0B,EAAAE,SAAQC,EAAU7B,IAAKqC,GAAI,QAAS,WACnCL,EAASM,QACTJ,EAAeI","file":"admin-distributed-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar openLinks = document.querySelectorAll('.open-distributor-help');\nvar helpLink = document.getElementById('contextual-help-link');\nvar distributorTab = document.querySelector('#tab-link-distributer a');\n\nfor (var i = 0; i < openLinks.length; i++) {\n\t(0, _jquery2.default)(openLinks[i]).on('click', function () {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// admin-distributed-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ebbc74364e6cc6835171","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst openLinks = document.querySelectorAll( '.open-distributor-help' );\nconst helpLink = document.getElementById( 'contextual-help-link' );\nconst distributorTab = document.querySelector( '#tab-link-distributer a' );\n\nfor ( let i = 0; i < openLinks.length; i++ ) {\n\tjQuery( openLinks[i] ).on( 'click', () => {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-distributed-post.js"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///admin-distributed-post.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-distributed-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","0","jQuery","5","_jquery","_jquery2","obj","default","openLinks","document","querySelectorAll","helpLink","getElementById","distributorTab","querySelector","length","on","click"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YGvEA,KAAM,GANN8B,GAAA9B,EAAA,GHkFI+B,EAEJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAIZ,WAAaY,GAAQC,QAASD,IAFjDF,GGhFhCI,EAAiBC,SAASC,iBAAkB,0BAC5CC,EAAiBF,SAASG,eAAgB,wBAC1CC,EAAiBJ,SAASK,cAAe,2BAErCnC,EAAI,EAAGA,EAAI6B,EAAUO,OAAQpC,KACtC,EAAA0B,EAAAE,SAAQC,EAAU7B,IAAKqC,GAAI,QAAS,WACnCL,EAASM,QACTJ,EAAeI","file":"admin-distributed-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 5);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar openLinks = document.querySelectorAll('.open-distributor-help');\nvar helpLink = document.getElementById('contextual-help-link');\nvar distributorTab = document.querySelector('#tab-link-distributer a');\n\nfor (var i = 0; i < openLinks.length; i++) {\n\t(0, _jquery2.default)(openLinks[i]).on('click', function () {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// admin-distributed-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst openLinks = document.querySelectorAll( '.open-distributor-help' );\nconst helpLink = document.getElementById( 'contextual-help-link' );\nconst distributorTab = document.querySelector( '#tab-link-distributer a' );\n\nfor ( let i = 0; i < openLinks.length; i++ ) {\n\tjQuery( openLinks[i] ).on( 'click', () => {\n\t\thelpLink.click();\n\t\tdistributorTab.click();\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-distributed-post.js"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/js/admin-external-connection.min.js.map b/dist/js/admin-external-connection.min.js.map
index f04ace299..3f616cc93 100644
--- a/dist/js/admin-external-connection.min.js.map
+++ b/dist/js/admin-external-connection.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap ebbc74364e6cc6835171","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/admin-external-connection.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","checkConnections","$apiVerify","abort","externalConnectionUrlField","value","endpointErrors","innerText","endpointResult","removeAttribute","setAttribute","dt","endpoint_checking_message","auth","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","ajax","url","ajaxurl","method","data","nonce","action","type","externalConnectionTypeField","endpointId","done","response","success","errors","no_external_connection","endpoint_suggestion","suggestion","document","createElement","classList","add","appendChild","bad_connection","no_distributor","can_post","length","limited_connection","warnings","bad_auth","push","no_push","pull_limited","forEach","warning","warningNode","append","good_connection","complete","remove","_jquery","_jquery2","_underscores","_underscores2","_window","getElementsByClassName","externalConnectionMetaBox","getElementById","rolesAllowed","titleField","querySelector","setTimeout","on","event","currentTarget","trigger","debounce","replace","focus","blur","passwordField","usernameField","changePassword","style","display","preventDefault","cancel","change","target","contains","checked","alert","roles_warning","$hideUntilAuthed","$authCredentials","$clientSecret","$clientId","hideItemsRequiringAuth","hide","validateField","$field","val","addClass","removeClass","slug","show","createConnectionButton","validateClientSecret","validateClientId","changeCredentials","$authenticationDetailsWrapper","beginAuthorize","$titleEl","title","id","admin_url","history","pushState"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMM,SAAUtB,EAAQD,GEnExBC,EAAAD,QAAAwB,QFyEM,SAAUvB,EAAQD,GGzExBC,EAAAD,QAAAyB,QH+EM,SAAUxB,EAAQD,GI/ExBC,EAAAD,QAAA0B,GJqFM,SAAUzB,EAAQD,EAASH,GAEjC,YAaA,SAAS8B,GAAuBC,GAAO,MAAOA,IAAOA,EAAIX,WAAaW,GAAQC,QAASD,GKrFvF,QAASE,KAKR,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SAAS6B,eAAgB,oBAAsBkC,IAAK/E,IAC5D,EAAAuC,EAAA9D,SAAQuC,SAAS6B,eAAgB,uBAAyBkC,IAAKrE,EAASP,KAAKyF,KAC7E,EAAArD,EAAA9D,SAAQuC,SAAS6B,eAAgB,yBAA2BkC,IAAK,YAGjE,EAAAxC,EAAA9D,SAAQ,uCAAwCmG,OAChDY,EAA8BL,UAI5B/C,SAAU,YAGb,EAAAG,EAAA9D,SAAQgH,GAAiBR,YAAa","file":"admin-external-connection.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar externalConnectionUrlField = document.getElementsByClassName('external-connection-url-field')[0];\nvar externalConnectionMetaBox = document.getElementById('dt_external_connection_details');\nvar externalConnectionTypeField = document.getElementsByClassName('external-connection-type-field')[0];\nvar authFields = document.getElementsByClassName('auth-field');\nvar rolesAllowed = document.getElementsByClassName('dt-roles-allowed');\nvar titleField = document.getElementById('title');\nvar endpointResult = document.querySelector('.endpoint-result');\nvar endpointErrors = document.querySelector('.endpoint-errors');\nvar postIdField = document.getElementById('post_ID');\nvar $apiVerify = false;\n\nfunction checkConnections() {\n\tif (false !== $apiVerify) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ('' === externalConnectionUrlField.value) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute('data-endpoint-state');\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute('data-endpoint-state', 'loading');\n\tendpointResult.innerText = _window.dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tvar auth = {};\n\n\t_underscores2.default.each(authFields, function (authField) {\n\t\tif (authField.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute('data-auth-field');\n\n\t\tif (key) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t});\n\n\tvar postId = 0;\n\tif (postIdField && postIdField.value) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = _jquery2.default.ajax({\n\t\turl: _window.ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: _window.dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t}).done(function (response) {\n\t\tif (!response.success) {\n\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\t\t} else {\n\t\t\tif (response.data.errors.no_external_connection) {\n\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\n\t\t\t\tif (response.data.endpoint_suggestion) {\n\t\t\t\t\tendpointResult.innerText = _window.dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tvar suggestion = document.createElement('a');\n\t\t\t\t\tsuggestion.classList.add('suggest');\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild(suggestion);\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = _window.dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (response.data.errors.no_distributor || !response.data.can_post.length) {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'warning');\n\t\t\t\t\tendpointResult.innerText = _window.dt.limited_connection;\n\n\t\t\t\t\tvar warnings = [];\n\n\t\t\t\t\tif (response.data.errors.no_distributor) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push(_window.dt.no_push);\n\t\t\t\t\twarnings.push(_window.dt.pull_limited);\n\n\t\t\t\t\twarnings.forEach(function (warning) {\n\t\t\t\t\t\tvar warningNode = document.createElement('li');\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append(warningNode);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'valid');\n\t\t\t\t\tendpointResult.innerText = _window.dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}).complete(function () {\n\t\tendpointResult.classList.remove('loading');\n\t});\n}\n\nsetTimeout(function () {\n\tcheckConnections();\n}, 300);\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('click', '.suggest', function (event) {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\t(0, _jquery2.default)(externalConnectionUrlField).trigger('input');\n});\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('keyup input', '.auth-field, .external-connection-url-field', _underscores2.default.debounce(checkConnections, 250));\n\n(0, _jquery2.default)(externalConnectionUrlField).on('blur', function (event) {\n\tif ('' === titleField.value && '' !== event.currentTarget.value) {\n\t\ttitleField.value = event.currentTarget.value.replace(/https?:\\/\\//i, '');\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n});\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nvar passwordField = document.getElementById('dt_password');\nvar usernameField = document.getElementById('dt_username');\nvar changePassword = document.querySelector('.change-password');\n\n(0, _jquery2.default)(usernameField).on('keyup change', _underscores2.default.debounce(function () {\n\tif (changePassword) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250));\n\n(0, _jquery2.default)(changePassword).on('click', function (event) {\n\tevent.preventDefault();\n\n\tif (passwordField.disabled) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = _window.dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = _window.dt.change;\n\t}\n\n\tcheckConnections();\n});\n\n(0, _jquery2.default)(rolesAllowed).on('click', '.dt-role-checkbox', function (event) {\n\tif (!event.target.classList.contains('dt-role-checkbox')) {\n\t\treturn;\n\t}\n\n\tif (!event.target.checked) {\n\t\treturn;\n\t}\n\n\tif ('administrator' !== event.target.value && 'editor' !== event.target.value) {\n\t\talert(_window.dt.roles_warning);\n\t}\n});\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nvar $hideUntilAuthed = (0, _jquery2.default)('.hide-until-authed'),\n $authCredentials = (0, _jquery2.default)('.auth-credentials'),\n $clientSecret = (0, _jquery2.default)(document.getElementById('dt_client_secret')),\n $clientId = (0, _jquery2.default)(document.getElementById('dt_client_id')),\n hideItemsRequiringAuth = function hideItemsRequiringAuth() {\n\tvar oauthconnectionestablished = document.getElementsByClassName('oauth-connection-established');\n\tif (0 === oauthconnectionestablished.length) {\n\t\t$hideUntilAuthed.hide();\n\t}\n},\n\n\n/**\n * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n *\n * @param {jQuery DomElement} $field The field to check.\n */\nvalidateField = function validateField($field, event) {\n\tif ('' === $field.val()) {\n\t\tevent.preventDefault();\n\t\t$field.addClass('error-required');\n\t\treturn false;\n\t} else {\n\t\t$field.removeClass('error-required');\n\t}\n\treturn true;\n};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\n(0, _jquery2.default)(externalConnectionTypeField).on('change', function () {\n\tvar slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\t(0, _jquery2.default)('.auth-credentials.' + slug).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ('wpdotcom' === slug) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n});\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ('wpdotcom' === externalConnectionTypeField.value) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nvar createConnectionButton = document.getElementById('create-oauth-connection');\nif (createConnectionButton) {\n\t(0, _jquery2.default)(createConnectionButton).on('click', function (event) {\n\t\tvar validateClientSecret = validateField($clientSecret, event),\n\t\t validateClientId = validateField($clientId, event);\n\t\tif (!validateClientSecret || !validateClientId) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\n// Handle the changeCredentials link.\nvar changeCredentials = document.getElementById('oauth-authentication-change-credentials'),\n $authenticationDetailsWrapper = (0, _jquery2.default)('.oauth-authentication-details-wrapper');\n\nif (changeCredentials) {\n\n\t(0, _jquery2.default)(changeCredentials).on('click', function () {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val('');\n\n\t\t// Remove the authorized message.\n\t\t(0, _jquery2.default)('.oauth-connection-established').remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t});\n}\n\n// Handle the Authorize Connection button.\nvar beginAuthorize = document.getElementById('begin-authorization');\nif (beginAuthorize) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\t(0, _jquery2.default)(beginAuthorize).on('click', function (event) {\n\t\tvar $titleEl = (0, _jquery2.default)(titleField),\n\t\t title = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif (validateField($titleEl, event)) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\t(0, _jquery2.default)(beginAuthorize).addClass('disabled');\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass('error-required');\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\t_jquery2.default.ajax({\n\t\t\t\turl: _window.ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: _window.dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: (0, _jquery2.default)(document.getElementById('post_ID')).val()\n\t\t\t\t}\n\t\t\t}).done(function (response) {\n\t\t\t\tif (response.success && response.data.id) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tvar url = _window.dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState({}, 'Oauth Authorize Details', url);\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_redirect_uri')).val(url);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_created_post_id')).val(response.data.id);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('original_post_status')).val('publish');\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\t(0, _jquery2.default)('.oauth-begin-authentication-wrapper').hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t}).complete(function () {\n\n\t\t\t\t// Ensure the\n\t\t\t\t(0, _jquery2.default)(beginAuthorize).removeClass('disabled');\n\t\t\t});\n\t\t}\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-external-connection.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ebbc74364e6cc6835171","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, ajaxurl } from 'window';\n\nconst externalConnectionUrlField = document.getElementsByClassName( 'external-connection-url-field' )[0];\nconst externalConnectionMetaBox = document.getElementById( 'dt_external_connection_details' );\nconst externalConnectionTypeField = document.getElementsByClassName( 'external-connection-type-field' )[0];\nconst authFields = document.getElementsByClassName( 'auth-field' );\nconst rolesAllowed = document.getElementsByClassName( 'dt-roles-allowed' );\nconst titleField = document.getElementById( 'title' );\nconst endpointResult = document.querySelector( '.endpoint-result' );\nconst endpointErrors = document.querySelector( '.endpoint-errors' );\nconst postIdField = document.getElementById( 'post_ID' );\nlet $apiVerify = false;\n\nfunction checkConnections() {\n\tif ( false !== $apiVerify ) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ( '' === externalConnectionUrlField.value ) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute( 'data-endpoint-state' );\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute( 'data-endpoint-state', 'loading' );\n\tendpointResult.innerText = dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tconst auth = {};\n\n\t_.each( authFields, ( authField ) => {\n\t\tif ( authField.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute( 'data-auth-field' );\n\n\t\tif ( key ) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t} );\n\n\tlet postId = 0;\n\tif ( postIdField && postIdField.value ) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = jQuery.ajax( {\n\t\turl: ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t} ).done( ( response ) => {\n\t\tif ( ! response.success ) {\n\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\t\t} else {\n\t\t\tif ( response.data.errors.no_external_connection ) {\n\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\n\t\t\t\tif ( response.data.endpoint_suggestion ) {\n\t\t\t\t\tendpointResult.innerText = dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tconst suggestion = document.createElement( 'a' );\n\t\t\t\t\tsuggestion.classList.add( 'suggest' );\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild( suggestion );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( response.data.errors.no_distributor || ! response.data.can_post.length ) {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'warning' );\n\t\t\t\t\tendpointResult.innerText = dt.limited_connection;\n\n\t\t\t\t\tconst warnings = [];\n\n\t\t\t\t\tif ( response.data.errors.no_distributor ) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push( dt.no_push );\n\t\t\t\t\twarnings.push( dt.pull_limited );\n\n\t\t\t\t\twarnings.forEach( ( warning ) => {\n\t\t\t\t\t\tconst warningNode = document.createElement( 'li' );\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append( warningNode );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'valid' );\n\t\t\t\t\tendpointResult.innerText = dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} ).complete( () => {\n\t\tendpointResult.classList.remove( 'loading' );\n\t} );\n}\n\nsetTimeout( () => {\n\tcheckConnections();\n}, 300 );\n\njQuery( externalConnectionMetaBox ).on( 'click', '.suggest', ( event ) => {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\tjQuery( externalConnectionUrlField ).trigger( 'input' );\n} );\n\njQuery( externalConnectionMetaBox ).on( 'keyup input', '.auth-field, .external-connection-url-field', _.debounce( checkConnections, 250 ) );\n\njQuery( externalConnectionUrlField ).on( 'blur', ( event ) => {\n\tif ( '' === titleField.value && '' !== event.currentTarget.value ) {\n\t\ttitleField.value = event.currentTarget.value.replace( /https?:\\/\\//i, '' );\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n} );\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nconst passwordField = document.getElementById( 'dt_password' );\nconst usernameField = document.getElementById( 'dt_username' );\nconst changePassword = document.querySelector( '.change-password' );\n\njQuery( usernameField ).on( 'keyup change', _.debounce( () => {\n\tif ( changePassword ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250 ) );\n\njQuery( changePassword ).on( 'click', ( event ) => {\n\tevent.preventDefault();\n\n\tif ( passwordField.disabled ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = dt.change;\n\t}\n\n\tcheckConnections();\n} );\n\njQuery( rolesAllowed ).on( 'click', '.dt-role-checkbox', ( event ) => {\n\tif ( ! event.target.classList.contains( 'dt-role-checkbox' ) ) {\n\t\treturn;\n\t}\n\n\tif ( ! event.target.checked ) {\n\t\treturn;\n\t}\n\n\tif ( 'administrator' !== event.target.value && 'editor' !== event.target.value ) {\n\t\talert( dt.roles_warning );\n\t}\n} );\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nconst $hideUntilAuthed = jQuery( '.hide-until-authed' ),\n\t$authCredentials = jQuery( '.auth-credentials' ),\n\t$clientSecret = jQuery( document.getElementById( 'dt_client_secret' ) ),\n\t$clientId = jQuery( document.getElementById( 'dt_client_id' ) ),\n\thideItemsRequiringAuth = () => {\n\t\tconst oauthconnectionestablished = document.getElementsByClassName( 'oauth-connection-established' );\n\t\tif ( 0 === oauthconnectionestablished.length ) {\n\t\t\t$hideUntilAuthed.hide();\n\t\t}\n\t},\n\n\t/**\n\t * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n\t *\n\t * @param {jQuery DomElement} $field The field to check.\n\t */\n\tvalidateField = ( $field, event ) => {\n\t\tif ( '' === $field.val() ) {\n\t\t\tevent.preventDefault();\n\t\t\t$field.addClass( 'error-required' );\n\t\t\treturn false;\n\t\t} else {\n\t\t\t$field.removeClass( 'error-required' );\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\njQuery( externalConnectionTypeField ).on( 'change', () => {\n\tconst slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\tjQuery( '.auth-credentials.' + slug ).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ( 'wpdotcom' === slug ) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n} );\n\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ( 'wpdotcom' === externalConnectionTypeField.value ) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nconst createConnectionButton = document.getElementById( 'create-oauth-connection' );\nif ( createConnectionButton ) {\n\tjQuery( createConnectionButton ).on( 'click', ( event ) => {\n\t\tconst validateClientSecret = validateField( $clientSecret, event ),\n\t\t\tvalidateClientId = validateField( $clientId, event );\n\t\tif (\n\t\t\t! validateClientSecret ||\n\t\t\t! validateClientId\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t} );\n}\n\n// Handle the changeCredentials link.\nconst changeCredentials = document.getElementById( 'oauth-authentication-change-credentials' ),\n\t$authenticationDetailsWrapper = jQuery( '.oauth-authentication-details-wrapper' );\n\nif ( changeCredentials ) {\n\n\tjQuery( changeCredentials ).on( 'click', function() {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val( '' );\n\n\t\t// Remove the authorized message.\n\t\tjQuery( '.oauth-connection-established' ).remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t} );\n}\n\n// Handle the Authorize Connection button.\nconst beginAuthorize = document.getElementById( 'begin-authorization' );\nif ( beginAuthorize ) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\tjQuery( beginAuthorize ).on( 'click', ( event ) => {\n\t\tconst $titleEl = jQuery( titleField ),\n\t\t\ttitle = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif ( validateField( $titleEl, event ) ) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\tjQuery( beginAuthorize ).addClass( 'disabled' );\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass( 'error-required' );\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: jQuery( document.getElementById( 'post_ID' ) ).val()\n\t\t\t\t}\n\t\t\t} ).done( ( response ) => {\n\t\t\t\tif ( response.success && response.data.id ) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tconst url = dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState( {}, 'Oauth Authorize Details', url );\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\tjQuery( document.getElementById( 'dt_redirect_uri' ) ).val( url );\n\t\t\t\t\tjQuery( document.getElementById( 'dt_created_post_id' ) ).val( response.data.id );\n\t\t\t\t\tjQuery( document.getElementById( 'original_post_status' ) ).val( 'publish' );\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\tjQuery( '.oauth-begin-authentication-wrapper' ).hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t} ).complete( () => {\n\n\t\t\t\t// Ensure the\n\t\t\t\tjQuery( beginAuthorize ).removeClass( 'disabled' );\n\t\t\t} );\n\t\t}\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-external-connection.js"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/admin-external-connection.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","checkConnections","$apiVerify","abort","externalConnectionUrlField","value","endpointErrors","innerText","endpointResult","removeAttribute","setAttribute","dt","endpoint_checking_message","auth","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","ajax","url","ajaxurl","method","data","nonce","action","type","externalConnectionTypeField","endpointId","done","response","success","errors","no_external_connection","endpoint_suggestion","suggestion","document","createElement","classList","add","appendChild","bad_connection","no_distributor","can_post","length","limited_connection","warnings","bad_auth","push","no_push","pull_limited","forEach","warning","warningNode","append","good_connection","complete","remove","_jquery","_jquery2","_underscores","_underscores2","_window","getElementsByClassName","externalConnectionMetaBox","getElementById","rolesAllowed","titleField","querySelector","setTimeout","on","event","currentTarget","trigger","debounce","replace","focus","blur","passwordField","usernameField","changePassword","style","display","preventDefault","cancel","change","target","contains","checked","alert","roles_warning","$hideUntilAuthed","$authCredentials","$clientSecret","$clientId","hideItemsRequiringAuth","hide","validateField","$field","val","addClass","removeClass","slug","show","createConnectionButton","validateClientSecret","validateClientId","changeCredentials","$authenticationDetailsWrapper","beginAuthorize","$titleEl","title","id","admin_url","history","pushState"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WA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AQD,EAASX,KAGbF,GAAea,EAAUvC,MAG7B,EAAAZ,EAAA9D,SAAQgH,GAAiBT,SAAU,YAGnCU,EAAST,YAAa,kBAGtB7G,UAAO2B,MACNC,IAAKC,UACLC,OAAQ,OACRC,MACCC,MAAOhB,KAAGgB,MACVC,OAAQ,yBACRsF,MAAOA,EACPC,IAAI,EAAArD,EAAA9D,SAAQuC,SAAS6B,eAAgB,YAAckC,SAEjDtE,KAAM,SAAEC,GACX,GAAKA,EAASC,SAAWD,EAASP,KAAKyF,GAAK,CAG3C,GAAM5F,GAAMZ,KAAGyG,UAAY,iBAAmBnF,EAASP,KAAKyF,GAAM,cAClEE,SAAQC,aAAe,0BAA2B/F,IAGlD,EAAAuC,EAAA9D,SAAQuC,SAAS6B,eAAgB,oBAAsBkC,IAAK/E,IAC5D,EAAAuC,EAAA9D,SAAQuC,SAAS6B,eAAgB,uBAAyBkC,IAAKrE,EAASP,KAAKyF,KAC7E,EAAArD,EAAA9D,SAAQuC,SAAS6B,eAAgB,yBAA2BkC,IAAK,YAGjE,EAAAxC,EAAA9D,SAAQ,uCAAwCmG,OAChDY,EAA8BL,UAI5B/C,SAAU,YAGb,EAAAG,EAAA9D,SAAQgH,GAAiBR,YAAa","file":"admin-external-connection.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 3);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar externalConnectionUrlField = document.getElementsByClassName('external-connection-url-field')[0];\nvar externalConnectionMetaBox = document.getElementById('dt_external_connection_details');\nvar externalConnectionTypeField = document.getElementsByClassName('external-connection-type-field')[0];\nvar authFields = document.getElementsByClassName('auth-field');\nvar rolesAllowed = document.getElementsByClassName('dt-roles-allowed');\nvar titleField = document.getElementById('title');\nvar endpointResult = document.querySelector('.endpoint-result');\nvar endpointErrors = document.querySelector('.endpoint-errors');\nvar postIdField = document.getElementById('post_ID');\nvar $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif (false !== $apiVerify) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ('' === externalConnectionUrlField.value) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute('data-endpoint-state');\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute('data-endpoint-state', 'loading');\n\tendpointResult.innerText = _window.dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tvar auth = {};\n\n\t_underscores2.default.each(authFields, function (authField) {\n\t\tif (authField.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute('data-auth-field');\n\n\t\tif (key) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t});\n\n\tvar postId = 0;\n\tif (postIdField && postIdField.value) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = _jquery2.default.ajax({\n\t\turl: _window.ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: _window.dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t}).done(function (response) {\n\t\tif (!response.success) {\n\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\t\t} else {\n\t\t\tif (response.data.errors.no_external_connection) {\n\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'error');\n\n\t\t\t\tif (response.data.endpoint_suggestion) {\n\t\t\t\t\tendpointResult.innerText = _window.dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tvar suggestion = document.createElement('a');\n\t\t\t\t\tsuggestion.classList.add('suggest');\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild(suggestion);\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = _window.dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (response.data.errors.no_distributor || !response.data.can_post.length) {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'warning');\n\t\t\t\t\tendpointResult.innerText = _window.dt.limited_connection;\n\n\t\t\t\t\tvar warnings = [];\n\n\t\t\t\t\tif (response.data.errors.no_distributor) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + _window.dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push(_window.dt.no_push);\n\t\t\t\t\twarnings.push(_window.dt.pull_limited);\n\n\t\t\t\t\twarnings.forEach(function (warning) {\n\t\t\t\t\t\tvar warningNode = document.createElement('li');\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append(warningNode);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute('data-endpoint-state', 'valid');\n\t\t\t\t\tendpointResult.innerText = _window.dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}).complete(function () {\n\t\tendpointResult.classList.remove('loading');\n\t});\n}\n\nsetTimeout(function () {\n\tcheckConnections();\n}, 300);\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('click', '.suggest', function (event) {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\t(0, _jquery2.default)(externalConnectionUrlField).trigger('input');\n});\n\n(0, _jquery2.default)(externalConnectionMetaBox).on('keyup input', '.auth-field, .external-connection-url-field', _underscores2.default.debounce(checkConnections, 250));\n\n(0, _jquery2.default)(externalConnectionUrlField).on('blur', function (event) {\n\tif ('' === titleField.value && '' !== event.currentTarget.value) {\n\t\ttitleField.value = event.currentTarget.value.replace(/https?:\\/\\//i, '');\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n});\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nvar passwordField = document.getElementById('dt_password');\nvar usernameField = document.getElementById('dt_username');\nvar changePassword = document.querySelector('.change-password');\n\n(0, _jquery2.default)(usernameField).on('keyup change', _underscores2.default.debounce(function () {\n\tif (changePassword) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250));\n\n(0, _jquery2.default)(changePassword).on('click', function (event) {\n\tevent.preventDefault();\n\n\tif (passwordField.disabled) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = _window.dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = _window.dt.change;\n\t}\n\n\tcheckConnections();\n});\n\n(0, _jquery2.default)(rolesAllowed).on('click', '.dt-role-checkbox', function (event) {\n\tif (!event.target.classList.contains('dt-role-checkbox')) {\n\t\treturn;\n\t}\n\n\tif (!event.target.checked) {\n\t\treturn;\n\t}\n\n\tif ('administrator' !== event.target.value && 'editor' !== event.target.value) {\n\t\talert(_window.dt.roles_warning); // eslint-disable-line no-alert\n\t}\n});\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nvar $hideUntilAuthed = (0, _jquery2.default)('.hide-until-authed'),\n $authCredentials = (0, _jquery2.default)('.auth-credentials'),\n $clientSecret = (0, _jquery2.default)(document.getElementById('dt_client_secret')),\n $clientId = (0, _jquery2.default)(document.getElementById('dt_client_id')),\n hideItemsRequiringAuth = function hideItemsRequiringAuth() {\n\tvar oauthconnectionestablished = document.getElementsByClassName('oauth-connection-established');\n\tif (0 === oauthconnectionestablished.length) {\n\t\t$hideUntilAuthed.hide();\n\t}\n},\n\n\n/**\n * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n *\n * @param {jQuery DomElement} $field The field to check.\n */\nvalidateField = function validateField($field, event) {\n\tif ('' === $field.val()) {\n\t\tevent.preventDefault();\n\t\t$field.addClass('error-required');\n\t\treturn false;\n\t} else {\n\t\t$field.removeClass('error-required');\n\t}\n\treturn true;\n};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\n(0, _jquery2.default)(externalConnectionTypeField).on('change', function () {\n\tvar slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\t(0, _jquery2.default)('.auth-credentials.' + slug).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ('wpdotcom' === slug) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n});\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ('wpdotcom' === externalConnectionTypeField.value) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nvar createConnectionButton = document.getElementById('create-oauth-connection');\nif (createConnectionButton) {\n\t(0, _jquery2.default)(createConnectionButton).on('click', function (event) {\n\t\tvar validateClientSecret = validateField($clientSecret, event),\n\t\t validateClientId = validateField($clientId, event);\n\t\tif (!validateClientSecret || !validateClientId) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t});\n}\n\n// Handle the changeCredentials link.\nvar changeCredentials = document.getElementById('oauth-authentication-change-credentials'),\n $authenticationDetailsWrapper = (0, _jquery2.default)('.oauth-authentication-details-wrapper');\n\nif (changeCredentials) {\n\n\t(0, _jquery2.default)(changeCredentials).on('click', function () {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val('');\n\n\t\t// Remove the authorized message.\n\t\t(0, _jquery2.default)('.oauth-connection-established').remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t});\n}\n\n// Handle the Authorize Connection button.\nvar beginAuthorize = document.getElementById('begin-authorization');\nif (beginAuthorize) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\t(0, _jquery2.default)(beginAuthorize).on('click', function (event) {\n\t\tvar $titleEl = (0, _jquery2.default)(titleField),\n\t\t title = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif (validateField($titleEl, event)) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\t(0, _jquery2.default)(beginAuthorize).addClass('disabled');\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass('error-required');\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\t_jquery2.default.ajax({\n\t\t\t\turl: _window.ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: _window.dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: (0, _jquery2.default)(document.getElementById('post_ID')).val()\n\t\t\t\t}\n\t\t\t}).done(function (response) {\n\t\t\t\tif (response.success && response.data.id) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tvar url = _window.dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState({}, 'Oauth Authorize Details', url);\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_redirect_uri')).val(url);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('dt_created_post_id')).val(response.data.id);\n\t\t\t\t\t(0, _jquery2.default)(document.getElementById('original_post_status')).val('publish');\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\t(0, _jquery2.default)('.oauth-begin-authentication-wrapper').hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t}).complete(function () {\n\n\t\t\t\t// Ensure the\n\t\t\t\t(0, _jquery2.default)(beginAuthorize).removeClass('disabled');\n\t\t\t});\n\t\t}\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-external-connection.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, ajaxurl } from 'window';\n\nconst externalConnectionUrlField = document.getElementsByClassName( 'external-connection-url-field' )[0];\nconst externalConnectionMetaBox = document.getElementById( 'dt_external_connection_details' );\nconst externalConnectionTypeField = document.getElementsByClassName( 'external-connection-type-field' )[0];\nconst authFields = document.getElementsByClassName( 'auth-field' );\nconst rolesAllowed = document.getElementsByClassName( 'dt-roles-allowed' );\nconst titleField = document.getElementById( 'title' );\nconst endpointResult = document.querySelector( '.endpoint-result' );\nconst endpointErrors = document.querySelector( '.endpoint-errors' );\nconst postIdField = document.getElementById( 'post_ID' );\nlet $apiVerify = false;\n\n/**\n * Check the external connection.\n */\nfunction checkConnections() {\n\tif ( false !== $apiVerify ) {\n\t\t$apiVerify.abort();\n\t}\n\n\tif ( '' === externalConnectionUrlField.value ) {\n\t\tendpointErrors.innerText = '';\n\t\tendpointResult.innerText = '';\n\n\t\tendpointResult.removeAttribute( 'data-endpoint-state' );\n\t\treturn;\n\t}\n\n\tendpointResult.setAttribute( 'data-endpoint-state', 'loading' );\n\tendpointResult.innerText = dt.endpoint_checking_message;\n\n\tendpointErrors.innerText = '';\n\n\tconst auth = {};\n\n\t_.each( authFields, ( authField ) => {\n\t\tif ( authField.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar key = authField.getAttribute( 'data-auth-field' );\n\n\t\tif ( key ) {\n\t\t\tauth[key] = authField.value;\n\t\t}\n\t} );\n\n\tlet postId = 0;\n\tif ( postIdField && postIdField.value ) {\n\t\tpostId = postIdField.value;\n\t}\n\n\t$apiVerify = jQuery.ajax( {\n\t\turl: ajaxurl,\n\t\tmethod: 'post',\n\t\tdata: {\n\t\t\tnonce: dt.nonce,\n\t\t\taction: 'dt_verify_external_connection',\n\t\t\tauth: auth,\n\t\t\turl: externalConnectionUrlField.value,\n\t\t\ttype: externalConnectionTypeField.value,\n\t\t\tendpointId: postId\n\t\t}\n\t} ).done( ( response ) => {\n\t\tif ( ! response.success ) {\n\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\t\t} else {\n\t\t\tif ( response.data.errors.no_external_connection ) {\n\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'error' );\n\n\t\t\t\tif ( response.data.endpoint_suggestion ) {\n\t\t\t\t\tendpointResult.innerText = dt.endpoint_suggestion + ' ';\n\n\t\t\t\t\tconst suggestion = document.createElement( 'a' );\n\t\t\t\t\tsuggestion.classList.add( 'suggest' );\n\t\t\t\t\tsuggestion.innerText = response.data.endpoint_suggestion;\n\n\t\t\t\t\tendpointResult.appendChild( suggestion );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.innerText = dt.bad_connection;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( response.data.errors.no_distributor || ! response.data.can_post.length ) {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'warning' );\n\t\t\t\t\tendpointResult.innerText = dt.limited_connection;\n\n\t\t\t\t\tconst warnings = [];\n\n\t\t\t\t\tif ( response.data.errors.no_distributor ) {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.no_distributor;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpointResult.innerText += ' ' + dt.bad_auth;\n\t\t\t\t\t}\n\n\t\t\t\t\twarnings.push( dt.no_push );\n\t\t\t\t\twarnings.push( dt.pull_limited );\n\n\t\t\t\t\twarnings.forEach( ( warning ) => {\n\t\t\t\t\t\tconst warningNode = document.createElement( 'li' );\n\t\t\t\t\t\twarningNode.innerText = warning;\n\n\t\t\t\t\t\tendpointErrors.append( warningNode );\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tendpointResult.setAttribute( 'data-endpoint-state', 'valid' );\n\t\t\t\t\tendpointResult.innerText = dt.good_connection;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} ).complete( () => {\n\t\tendpointResult.classList.remove( 'loading' );\n\t} );\n}\n\nsetTimeout( () => {\n\tcheckConnections();\n}, 300 );\n\njQuery( externalConnectionMetaBox ).on( 'click', '.suggest', ( event ) => {\n\texternalConnectionUrlField.value = event.currentTarget.innerText;\n\tjQuery( externalConnectionUrlField ).trigger( 'input' );\n} );\n\njQuery( externalConnectionMetaBox ).on( 'keyup input', '.auth-field, .external-connection-url-field', _.debounce( checkConnections, 250 ) );\n\njQuery( externalConnectionUrlField ).on( 'blur', ( event ) => {\n\tif ( '' === titleField.value && '' !== event.currentTarget.value ) {\n\t\ttitleField.value = event.currentTarget.value.replace( /https?:\\/\\//i, '' );\n\t\ttitleField.focus();\n\t\ttitleField.blur();\n\t}\n} );\n/**\n * JS for basic auth\n *\n * @todo separate\n */\nconst passwordField = document.getElementById( 'dt_password' );\nconst usernameField = document.getElementById( 'dt_username' );\nconst changePassword = document.querySelector( '.change-password' );\n\njQuery( usernameField ).on( 'keyup change', _.debounce( () => {\n\tif ( changePassword ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tchangePassword.style.display = 'none';\n\t}\n}, 250 ) );\n\njQuery( changePassword ).on( 'click', ( event ) => {\n\tevent.preventDefault();\n\n\tif ( passwordField.disabled ) {\n\t\tpasswordField.disabled = false;\n\t\tpasswordField.value = '';\n\t\tevent.currentTarget.innerText = dt.cancel;\n\t} else {\n\t\tpasswordField.disabled = true;\n\t\tpasswordField.value = 'sdfdsfsdfdsfdsfsd'; // filler password\n\t\tevent.currentTarget.innerText = dt.change;\n\t}\n\n\tcheckConnections();\n} );\n\njQuery( rolesAllowed ).on( 'click', '.dt-role-checkbox', ( event ) => {\n\tif ( ! event.target.classList.contains( 'dt-role-checkbox' ) ) {\n\t\treturn;\n\t}\n\n\tif ( ! event.target.checked ) {\n\t\treturn;\n\t}\n\n\tif ( 'administrator' !== event.target.value && 'editor' !== event.target.value ) {\n\t\talert( dt.roles_warning ); // eslint-disable-line no-alert\n\t}\n} );\n\n/**\n * Code for WordPress.com Oauth2 Authentication.\n *\n * @todo separate out code.\n */\n\n/**\n * If the client id and secret are unavailable, hide all '.hide-until-authed' areas.\n *\n * For Oauth authentication, simplify the interface by hiding certain elements until the user has\n * completed the authorization process.\n *\n * Creates a cleaner flow for authorization by separating the authorization steps.\n */\nconst $hideUntilAuthed = jQuery( '.hide-until-authed' ),\n\t$authCredentials = jQuery( '.auth-credentials' ),\n\t$clientSecret = jQuery( document.getElementById( 'dt_client_secret' ) ),\n\t$clientId = jQuery( document.getElementById( 'dt_client_id' ) ),\n\thideItemsRequiringAuth = () => {\n\t\tconst oauthconnectionestablished = document.getElementsByClassName( 'oauth-connection-established' );\n\t\tif ( 0 === oauthconnectionestablished.length ) {\n\t\t\t$hideUntilAuthed.hide();\n\t\t}\n\t},\n\n\t/**\n\t * Validate a form field, ensuring it is non-empty. Add an error class if empty.\n\t *\n\t * @param {jQuery DomElement} $field The field to check.\n\t */\n\tvalidateField = ( $field, event ) => {\n\t\tif ( '' === $field.val() ) {\n\t\t\tevent.preventDefault();\n\t\t\t$field.addClass( 'error-required' );\n\t\t\treturn false;\n\t\t} else {\n\t\t\t$field.removeClass( 'error-required' );\n\t\t}\n\t\treturn true;\n\t};\n\n/**\n * When the External connection type drop-down is changed, show the corresponding authorization fields.\n */\njQuery( externalConnectionTypeField ).on( 'change', () => {\n\tconst slug = externalConnectionTypeField.value;\n\n\t$authCredentials.hide();\n\tjQuery( '.auth-credentials.' + slug ).show();\n\n\t// For WordPress.com Oauth authentication, hide fields until authentication is complete.\n\tif ( 'wpdotcom' === slug ) {\n\t\thideItemsRequiringAuth();\n\t} else {\n\n\t\t// Otherwise, ensure all areas are showing.\n\t\t$hideUntilAuthed.show();\n\t}\n} );\n\n\n// On load for WordPress.com Oauth authentication, hide fields until authentication is complete.\nif ( 'wpdotcom' === externalConnectionTypeField.value ) {\n\thideItemsRequiringAuth();\n}\n\n// When authorization is initiated, ensure fields are non-empty.\nconst createConnectionButton = document.getElementById( 'create-oauth-connection' );\nif ( createConnectionButton ) {\n\tjQuery( createConnectionButton ).on( 'click', ( event ) => {\n\t\tconst validateClientSecret = validateField( $clientSecret, event ),\n\t\t\tvalidateClientId = validateField( $clientId, event );\n\t\tif (\n\t\t\t! validateClientSecret ||\n\t\t\t! validateClientId\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t} );\n}\n\n// Handle the changeCredentials link.\nconst changeCredentials = document.getElementById( 'oauth-authentication-change-credentials' ),\n\t$authenticationDetailsWrapper = jQuery( '.oauth-authentication-details-wrapper' );\n\nif ( changeCredentials ) {\n\n\tjQuery( changeCredentials ).on( 'click', function() {\n\n\t\t// Show the credentials fields.\n\t\t$authenticationDetailsWrapper.show();\n\n\t\t// Clear the secret field.\n\t\t$clientSecret.val( '' );\n\n\t\t// Remove the authorized message.\n\t\tjQuery( '.oauth-connection-established' ).remove();\n\n\t\t// Hide the remaining fields that only show after authorization is complete.\n\t\thideItemsRequiringAuth();\n\t} );\n}\n\n// Handle the Authorize Connection button.\nconst beginAuthorize = document.getElementById( 'begin-authorization' );\nif ( beginAuthorize ) {\n\n\t// Handle click to the wpdotcom begin-authorization button.\n\tjQuery( beginAuthorize ).on( 'click', ( event ) => {\n\t\tconst $titleEl = jQuery( titleField ),\n\t\t\ttitle = $titleEl.val();\n\n\t\t// Ensure the connection title is not blank.\n\t\tif ( validateField( $titleEl, event ) ) {\n\n\t\t\t// Disable the button during the ajax request.\n\t\t\tjQuery( beginAuthorize ).addClass( 'disabled' );\n\n\t\t\t// Remove any error highlighting.\n\t\t\t$titleEl.removeClass( 'error-required' );\n\n\t\t\t// Make an ajax request to save the connection and retrieve the resulting post id.\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: ajaxurl,\n\t\t\t\tmethod: 'post',\n\t\t\t\tdata: {\n\t\t\t\t\tnonce: dt.nonce,\n\t\t\t\t\taction: 'dt_begin_authorization',\n\t\t\t\t\ttitle: title,\n\t\t\t\t\tid: jQuery( document.getElementById( 'post_ID' ) ).val()\n\t\t\t\t}\n\t\t\t} ).done( ( response ) => {\n\t\t\t\tif ( response.success && response.data.id ) {\n\n\t\t\t\t\t// The post has been saved, update the url in case the user refreshes.\n\t\t\t\t\tconst url = dt.admin_url + 'post.php?post=' + response.data.id + '&action=edit';\n\t\t\t\t\thistory.pushState( {}, 'Oauth Authorize Details', url );\n\n\t\t\t\t\t// Update the form field for dt_redirect_uri and post id.\n\t\t\t\t\tjQuery( document.getElementById( 'dt_redirect_uri' ) ).val( url );\n\t\t\t\t\tjQuery( document.getElementById( 'dt_created_post_id' ) ).val( response.data.id );\n\t\t\t\t\tjQuery( document.getElementById( 'original_post_status' ) ).val( 'publish' );\n\n\t\t\t\t\t// Hide the first step and show the authentication details.\n\t\t\t\t\tjQuery( '.oauth-begin-authentication-wrapper' ).hide();\n\t\t\t\t\t$authenticationDetailsWrapper.show();\n\t\t\t\t} else {\n\t\t\t\t\t// @todo handle errors.\n\t\t\t\t}\n\t\t\t} ).complete( () => {\n\n\t\t\t\t// Ensure the\n\t\t\t\tjQuery( beginAuthorize ).removeClass( 'disabled' );\n\t\t\t} );\n\t\t}\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-external-connection.js"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/js/admin-pull.min.js.map b/dist/js/admin-pull.min.js.map
index 7c2261bcc..32031fbba 100644
--- a/dist/js/admin-pull.min.js.map
+++ b/dist/js/admin-pull.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///admin-pull.min.js","webpack:///webpack/bootstrap ebbc74364e6cc6835171","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-pull.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","_jquery","_jquery2","obj","default","chooseConnection","document","getElementById","choosePostType","choosePostTypeBtn","form","on","event","location","currentTarget","options","selectedIndex","getAttribute","body","className","preventDefault","postType","value","url","status","indexOf"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAA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ap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar chooseConnection = document.getElementById('pull_connections');\nvar choosePostType = document.getElementById('pull_post_type');\nvar choosePostTypeBtn = document.getElementById('pull_post_type_submit');\nvar form = document.getElementById('posts-filter');\n\n(0, _jquery2.default)(chooseConnection).on('change', function (event) {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute('data-pull-url');\n\n\tdocument.body.className += ' ' + 'dt-loading';\n});\n\nif (chooseConnection && choosePostType && choosePostTypeBtn && form) {\n\t(0, _jquery2.default)(choosePostTypeBtn).on('click', function (event) {\n\n\t\tevent.preventDefault();\n\n\t\tvar postType = choosePostType.options[choosePostType.selectedIndex].value;\n\t\tvar url = chooseConnection.options[chooseConnection.selectedIndex].getAttribute('data-pull-url');\n\t\tvar status = 'new';\n\n\t\tif (-1 < (' ' + form.className + ' ').indexOf(' status-skipped ')) {\n\t\t\tstatus = 'skipped';\n\t\t} else if (-1 < (' ' + form.className + ' ').indexOf(' status-pulled ')) {\n\t\t\tstatus = 'pulled';\n\t\t}\n\n\t\tdocument.location = url + '&pull_post_type=' + postType + '&status=' + status;\n\n\t\tdocument.body.className += ' ' + 'dt-loading';\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-pull.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ebbc74364e6cc6835171","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst chooseConnection = document.getElementById( 'pull_connections' );\nconst choosePostType = document.getElementById( 'pull_post_type' );\nconst choosePostTypeBtn = document.getElementById( 'pull_post_type_submit' );\nconst form = document.getElementById( 'posts-filter' );\n\njQuery( chooseConnection ).on( 'change', ( event ) => {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute( 'data-pull-url' );\n\n\tdocument.body.className += ' ' + 'dt-loading';\n} );\n\nif ( chooseConnection && choosePostType && choosePostTypeBtn && form ) {\n\tjQuery( choosePostTypeBtn ).on( 'click', ( event ) => {\n\n\t\tevent.preventDefault();\n\n\t\tconst postType = choosePostType.options[ choosePostType.selectedIndex ].value;\n\t\tconst url = chooseConnection.options[ chooseConnection.selectedIndex ].getAttribute( 'data-pull-url' );\n\t\tlet status = 'new';\n\n\t\tif ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-skipped ' ) ) {\n\t\t\tstatus = 'skipped';\n\t\t} else if ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-pulled ' ) ) {\n\t\t\tstatus = 'pulled';\n\t\t}\n\n\t\tdocument.location = url + '&pull_post_type=' + postType + '&status=' + status;\n\n\t\tdocument.body.className += ' ' + 'dt-loading';\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-pull.js"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///admin-pull.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///./assets/js/admin-pull.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","_jquery","_jquery2","obj","default","chooseConnection","document","getElementById","choosePostType","choosePostTypeBtn","form","on","event","location","currentTarget","options","selectedIndex","getAttribute","body","className","preventDefault","postType","value","url","status","indexOf"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,E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Q,eAAgBM,MAClEC,EAAMlB,EAAiBU,QAASV,EAAiBW,eAAgBC,aAAc,iBACjFO,EAAS,OAEP,GAAM,IAAMd,EAAKS,UAAY,KAAMM,QAAS,oBACjDD,EAAS,WACG,GAAM,IAAMd,EAAKS,UAAY,KAAMM,QAAS,qBACxDD,EAAS,UAGVlB,SAASO,SAAWU,EAAM,mBAAqBF,EAAW,WAAaG,EAEvElB,SAASY,KAAKC,WAAa","file":"admin-pull.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 4);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */,\n/* 2 */,\n/* 3 */,\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar chooseConnection = document.getElementById('pull_connections');\nvar choosePostType = document.getElementById('pull_post_type');\nvar choosePostTypeBtn = document.getElementById('pull_post_type_submit');\nvar form = document.getElementById('posts-filter');\n\n(0, _jquery2.default)(chooseConnection).on('change', function (event) {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute('data-pull-url');\n\n\tdocument.body.className += ' ' + 'dt-loading';\n});\n\nif (chooseConnection && choosePostType && choosePostTypeBtn && form) {\n\t(0, _jquery2.default)(choosePostTypeBtn).on('click', function (event) {\n\n\t\tevent.preventDefault();\n\n\t\tvar postType = choosePostType.options[choosePostType.selectedIndex].value;\n\t\tvar url = chooseConnection.options[chooseConnection.selectedIndex].getAttribute('data-pull-url');\n\t\tvar status = 'new';\n\n\t\tif (-1 < (' ' + form.className + ' ').indexOf(' status-skipped ')) {\n\t\t\tstatus = 'skipped';\n\t\t} else if (-1 < (' ' + form.className + ' ').indexOf(' status-pulled ')) {\n\t\t\tstatus = 'pulled';\n\t\t}\n\n\t\tdocument.location = url + '&pull_post_type=' + postType + '&status=' + status;\n\n\t\tdocument.body.className += ' ' + 'dt-loading';\n\t});\n}\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// admin-pull.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 4);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","import jQuery from 'jquery';\n\nconst chooseConnection = document.getElementById( 'pull_connections' );\nconst choosePostType = document.getElementById( 'pull_post_type' );\nconst choosePostTypeBtn = document.getElementById( 'pull_post_type_submit' );\nconst form = document.getElementById( 'posts-filter' );\n\njQuery( chooseConnection ).on( 'change', ( event ) => {\n\n\tdocument.location = event.currentTarget.options[event.currentTarget.selectedIndex].getAttribute( 'data-pull-url' );\n\n\tdocument.body.className += ' ' + 'dt-loading';\n} );\n\nif ( chooseConnection && choosePostType && choosePostTypeBtn && form ) {\n\tjQuery( choosePostTypeBtn ).on( 'click', ( event ) => {\n\n\t\tevent.preventDefault();\n\n\t\tconst postType = choosePostType.options[ choosePostType.selectedIndex ].value;\n\t\tconst url = chooseConnection.options[ chooseConnection.selectedIndex ].getAttribute( 'data-pull-url' );\n\t\tlet status = 'new';\n\n\t\tif ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-skipped ' ) ) {\n\t\t\tstatus = 'skipped';\n\t\t} else if ( -1 < ( ' ' + form.className + ' ' ).indexOf( ' status-pulled ' ) ) {\n\t\t\tstatus = 'pulled';\n\t\t}\n\n\t\tdocument.location = url + '&pull_post_type=' + postType + '&status=' + status;\n\n\t\tdocument.body.className += ' ' + 'dt-loading';\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/admin-pull.js"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/js/gutenberg-status-plugin.min.js.map b/dist/js/gutenberg-status-plugin.min.js.map
index 3ef49148d..5245dfb42 100644
--- a/dist/js/gutenberg-status-plugin.min.js.map
+++ b/dist/js/gutenberg-status-plugin.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap ebbc74364e6cc6835171","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-status-plugin.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","8","_window","wp","editPost","PluginPostStatusInfo","registerPlugin","plugins","__","i18n","renderDistributedFrom","React","createElement","id","dtGutenberg","syndicationTime","renderDistributedTo","sprintf","syndicationCount","parseInt","render"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAEA,QAAK,KAAuB+B,KAAGC,SAASC,qBAAuB,IACtDC,GAAmBH,KAAGI,QAAtBD,eACAE,EAAOL,KAAGM,KAAVD,GACAH,EAAyBF,KAAGC,SAA5BC,qBAEFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWE,cAAYC,gBAAvB,QAMEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNV,KAAGM,KAAKQ,QAASd,KAAGM,KAAKD,GAAI,sCAAuC,eACrEM,cAAYI,iBACZ,MAAQJ,cAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUL,cAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUL,cAAYC,kBACvCT,EAAgB,4BAA8Bc,OAAQV","file":"gutenberg-status-plugin.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 8:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\nif ('undefined' !== typeof _window.wp.editPost.PluginPostStatusInfo) {\n\tvar registerPlugin = _window.wp.plugins.registerPlugin;\n\tvar __ = _window.wp.i18n.__;\n\tvar PluginPostStatusInfo = _window.wp.editPost.PluginPostStatusInfo; // eslint-disable-line no-unused-vars\n\n\tvar renderDistributedFrom = function renderDistributedFrom() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-from' },\n\t\t\t\t__('Distributed on: '),\n\t\t\t\tReact.createElement(\n\t\t\t\t\t'strong',\n\t\t\t\t\tnull,\n\t\t\t\t\t' ',\n\t\t\t\t\t_window.dtGutenberg.syndicationTime,\n\t\t\t\t\t' '\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t};\n\n\tvar renderDistributedTo = function renderDistributedTo() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-to' },\n\t\t\t\t_window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed to %1$s connection%2$s.', 'distributor'), _window.dtGutenberg.syndicationCount, '1' === _window.dtGutenberg.syndicationCount ? '' : 's')\n\t\t\t)\n\t\t);\n\t};\n\n\tif (0 < parseInt(_window.dtGutenberg.syndicationCount)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedTo });\n\t} else if (0 !== parseInt(_window.dtGutenberg.syndicationTime)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedFrom });\n\t}\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-status-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ebbc74364e6cc6835171","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\nif ( 'undefined' !== typeof wp.editPost.PluginPostStatusInfo ) {\n\tconst { registerPlugin } = wp.plugins;\n\tconst { __ } = wp.i18n;\n\tconst { PluginPostStatusInfo } = wp.editPost; // eslint-disable-line no-unused-vars\n\n\tconst renderDistributedFrom = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Distributed on: ' ) }\n\t\t\t\t\t { dtGutenberg.syndicationTime } \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tconst renderDistributedTo = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ wp.i18n.sprintf( wp.i18n.__( 'Distributed to %1$s connection%2$s.', 'distributor' ),\n\t\t\t\t\t\tdtGutenberg.syndicationCount,\n\t\t\t\t\t\t'1' === dtGutenberg.syndicationCount ? '' : 's' ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tif ( 0 < parseInt( dtGutenberg.syndicationCount ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedTo } );\n\t} else if ( 0 !== parseInt( dtGutenberg.syndicationTime ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedFrom } );\n\t}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-status-plugin.js"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-status-plugin.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","8","_window","wp","editPost","PluginPostStatusInfo","registerPlugin","plugins","__","i18n","renderDistributedFrom","React","createElement","id","dtGutenberg","syndicationTime","renderDistributedTo","sprintf","syndicationCount","parseInt","render"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAEA,QAAK,KAAuB+B,KAAGC,SAASC,qBAAuB,IACtDC,GAAmBH,KAAGI,QAAtBD,eACAE,EAAOL,KAAGM,KAAVD,GACAH,EAAyBF,KAAGC,SAA5BC,qBAKFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWE,cAAYC,gBAAvB,QASEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNV,KAAGM,KAAKQ,QAASd,KAAGM,KAAKD,GAAI,sCAAuC,eACrEM,cAAYI,iBACZ,MAAQJ,cAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUL,cAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUL,cAAYC,kBACvCT,EAAgB,4BAA8Bc,OAAQV","file":"gutenberg-status-plugin.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 8:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\nif ('undefined' !== typeof _window.wp.editPost.PluginPostStatusInfo) {\n\tvar registerPlugin = _window.wp.plugins.registerPlugin;\n\tvar __ = _window.wp.i18n.__;\n\tvar PluginPostStatusInfo = _window.wp.editPost.PluginPostStatusInfo; // eslint-disable-line no-unused-vars\n\n\t/**\n * Render the distributed from component.\n */\n\n\tvar renderDistributedFrom = function renderDistributedFrom() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-from' },\n\t\t\t\t__('Distributed on: '),\n\t\t\t\tReact.createElement(\n\t\t\t\t\t'strong',\n\t\t\t\t\tnull,\n\t\t\t\t\t' ',\n\t\t\t\t\t_window.dtGutenberg.syndicationTime,\n\t\t\t\t\t' '\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t};\n\n\t/**\n * Render the distributed to component.\n */\n\tvar renderDistributedTo = function renderDistributedTo() {\n\t\treturn React.createElement(\n\t\t\tPluginPostStatusInfo,\n\t\t\tnull,\n\t\t\tReact.createElement(\n\t\t\t\t'span',\n\t\t\t\t{ id: 'distributed-to' },\n\t\t\t\t_window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed to %1$s connection%2$s.', 'distributor'), _window.dtGutenberg.syndicationCount, '1' === _window.dtGutenberg.syndicationCount ? '' : 's')\n\t\t\t)\n\t\t);\n\t};\n\n\tif (0 < parseInt(_window.dtGutenberg.syndicationCount)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedTo });\n\t} else if (0 !== parseInt(_window.dtGutenberg.syndicationTime)) {\n\t\tregisterPlugin('distributor-status-panel', { render: renderDistributedFrom });\n\t}\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-status-plugin.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\nif ( 'undefined' !== typeof wp.editPost.PluginPostStatusInfo ) {\n\tconst { registerPlugin } = wp.plugins;\n\tconst { __ } = wp.i18n;\n\tconst { PluginPostStatusInfo } = wp.editPost; // eslint-disable-line no-unused-vars\n\n\t/**\n\t * Render the distributed from component.\n\t */\n\tconst renderDistributedFrom = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ __( 'Distributed on: ' ) }\n\t\t\t\t\t { dtGutenberg.syndicationTime } \n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\t/**\n\t * Render the distributed to component.\n\t */\n\tconst renderDistributedTo = () => {\n\t\treturn(\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t{ wp.i18n.sprintf( wp.i18n.__( 'Distributed to %1$s connection%2$s.', 'distributor' ),\n\t\t\t\t\t\tdtGutenberg.syndicationCount,\n\t\t\t\t\t\t'1' === dtGutenberg.syndicationCount ? '' : 's' ) }\n\t\t\t\t\n\t\t\t\n\t\t);\n\t};\n\n\tif ( 0 < parseInt( dtGutenberg.syndicationCount ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedTo } );\n\t} else if ( 0 !== parseInt( dtGutenberg.syndicationTime ) ) {\n\t\tregisterPlugin( 'distributor-status-panel', { render: renderDistributedFrom } );\n\t}\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-status-plugin.js"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/js/gutenberg-syndicated-post.min.js.map b/dist/js/gutenberg-syndicated-post.min.js.map
index 172e3669b..7526256a9 100644
--- a/dist/js/gutenberg-syndicated-post.min.js.map
+++ b/dist/js/gutenberg-syndicated-post.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///gutenberg-syndicated-post.min.js","webpack:///webpack/bootstrap ebbc74364e6cc6835171","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-syndicated-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","7","_window","wp","i18n","setLocaleData","dtGutenberg","originalSourceId","originalBlogId","message","actions","parseInt","originalDelete","sprintf","__","postTypeSingular","originalLocationName","unlinked","push","label","url","linkNonceUrl","postUrl","unlinkNonceUrl","data","dispatch","createWarningNotice","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,GAGAzB,IAAA0B,EAAA,KDMMC,EACA,SAAUvB,EAAQD,GEpExBC,EAAAD,QAAAyB,QF0EMC,EACA,SAAUzB,EAAQD,EAASH,GAEjC,YG7EA,IAAA8B,GAAA9B,EAAA,EAKA,IAFA+B,KAAGC,KAAKC,cAAeC,cAAYF,KAAM,eAEpC,MAAQE,cAAYC,kBAAoB,MAAQD,cAAYE,eAAiB,CAEjF,GAAIC,GAAU,GACRC,IAEDC,UAAUL,cAAYM,gBAC1BH,EAAUN,KAAGC,KAAKS,QAASV,KAAGC,KAAKU,GAAI,gFAAkFR,cAAYS,iBAAkBT,cAAYU,sBACtJL,SAAUL,cAAYW,WAenCR,EAAUN,KAAGC,KAAKS,QAASV,KAAGC,KAAKU,GAAI,2GAA4G,eAAiBR,cAAYU,qBAAsBV,cAAYS,kBAElNL,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,cAAe,eACnCM,IAAKd,cAAYe,eAGlBX,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,gBAAiB,eACrCM,IAAKd,cAAYgB,YAvBlBb,EAAUN,KAAGC,KAAKS,QAASV,KAAGC,KAAKU,GAAI,gEAAiE,eAAiBR,cAAYU,sBAErIN,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKd,cAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOhB,KAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKd,cAAYgB,WAkBnBnB,KAAGqB,KAAKC,SAAU,gBAAiBC,oBAAqBjB,GACvDkB,GAAI,qBACJjB","file":"gutenberg-syndicated-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\n_window.wp.i18n.setLocaleData(_window.dtGutenberg.i18n, 'distributor');\n\nif ('0' !== _window.dtGutenberg.originalSourceId || '0' !== _window.dtGutenberg.originalBlogId) {\n\n\tvar message = '';\n\tvar actions = [];\n\n\tif (parseInt(_window.dtGutenberg.originalDelete)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('This %1$s was distributed from %2$s. However, the original has been deleted.'), _window.dtGutenberg.postTypeSingular, _window.dtGutenberg.originalLocationName);\n\t} else if (!parseInt(_window.dtGutenberg.unlinked)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed from %s. The original will update this unless you', 'distributor'), _window.dtGutenberg.originalLocationName);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('unlink from original.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.unlinkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t} else {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor'), _window.dtGutenberg.originalLocationName, _window.dtGutenberg.postTypeSingular);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('restore it.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.linkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t}\n\n\t_window.wp.data.dispatch('core/notices').createWarningNotice(message, {\n\t\tid: 'distributor-notice',\n\t\tactions: actions\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-syndicated-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ebbc74364e6cc6835171","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\n\nwp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' );\n\nif ( '0' !== dtGutenberg.originalSourceId || '0' !== dtGutenberg.originalBlogId ) {\n\n\tlet message = '';\n\tconst actions = [];\n\n\tif ( parseInt( dtGutenberg.originalDelete ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), dtGutenberg.postTypeSingular, dtGutenberg.originalLocationName );\n\t} else if ( ! parseInt( dtGutenberg.unlinked ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Distributed from %s. The original will update this unless you', 'distributor' ), dtGutenberg.originalLocationName );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'unlink from original.', 'distributor' ),\n\t\t\turl: dtGutenberg.unlinkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n.__( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl,\n\t\t} );\n\n\n\t} else {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor' ), dtGutenberg.originalLocationName, dtGutenberg.postTypeSingular );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'restore it.', 'distributor' ),\n\t\t\turl: dtGutenberg.linkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl\n\t\t} );\n\t}\n\n\twp.data.dispatch( 'core/notices' ).createWarningNotice( message, {\n\t\tid: 'distributor-notice',\n\t\tactions,\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-syndicated-post.js"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///gutenberg-syndicated-post.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"window\"","webpack:///./assets/js/gutenberg-syndicated-post.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","1","window","7","_window","wp","i18n","setLocaleData","dtGutenberg","originalSourceId","originalBlogId","message","actions","parseInt","originalDelete","sprintf","__","postTypeSingular","originalLocationName","unlinked","push","label","url","linkNonceUrl","postUrl","unlinkNonceUrl","data","dispatch","createWarningNotice","id"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAA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KS,QAASV,KAAGC,KAAKU,GAAI,gEAAiE,eAAiBR,cAAYU,sBAErIN,EAAQQ,MACPC,MAAOhB,KAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKd,cAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOhB,KAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKd,cAAYgB,WAkBnBnB,KAAGqB,KAAKC,SAAU,gBAAiBC,oBAAqBjB,GACvDkB,GAAI,qBACJjB","file":"gutenberg-syndicated-post.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 7);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 1:\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n\n/***/ 7:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _window = __webpack_require__(1);\n\n_window.wp.i18n.setLocaleData(_window.dtGutenberg.i18n, 'distributor');\n\nif ('0' !== _window.dtGutenberg.originalSourceId || '0' !== _window.dtGutenberg.originalBlogId) {\n\n\tvar message = '';\n\tvar actions = [];\n\n\tif (parseInt(_window.dtGutenberg.originalDelete)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('This %1$s was distributed from %2$s. However, the original has been deleted.'), _window.dtGutenberg.postTypeSingular, _window.dtGutenberg.originalLocationName);\n\t} else if (!parseInt(_window.dtGutenberg.unlinked)) {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Distributed from %s. The original will update this unless you', 'distributor'), _window.dtGutenberg.originalLocationName);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('unlink from original.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.unlinkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t} else {\n\t\tmessage = _window.wp.i18n.sprintf(_window.wp.i18n.__('Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor'), _window.dtGutenberg.originalLocationName, _window.dtGutenberg.postTypeSingular);\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('restore it.', 'distributor'),\n\t\t\turl: _window.dtGutenberg.linkNonceUrl\n\t\t});\n\n\t\tactions.push({\n\t\t\tlabel: _window.wp.i18n.__('View Original', 'distributor'),\n\t\t\turl: _window.dtGutenberg.postUrl\n\t\t});\n\t}\n\n\t_window.wp.data.dispatch('core/notices').createWarningNotice(message, {\n\t\tid: 'distributor-notice',\n\t\tactions: actions\n\t});\n}\n\n/***/ })\n\n/******/ });\n\n\n// WEBPACK FOOTER //\n// gutenberg-syndicated-post.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 7);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","import { wp, dtGutenberg } from 'window';\n\n\nwp.i18n.setLocaleData( dtGutenberg.i18n, 'distributor' );\n\nif ( '0' !== dtGutenberg.originalSourceId || '0' !== dtGutenberg.originalBlogId ) {\n\n\tlet message = '';\n\tconst actions = [];\n\n\tif ( parseInt( dtGutenberg.originalDelete ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'This %1$s was distributed from %2$s. However, the original has been deleted.' ), dtGutenberg.postTypeSingular, dtGutenberg.originalLocationName );\n\t} else if ( ! parseInt( dtGutenberg.unlinked ) ) {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Distributed from %s. The original will update this unless you', 'distributor' ), dtGutenberg.originalLocationName );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'unlink from original.', 'distributor' ),\n\t\t\turl: dtGutenberg.unlinkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n.__( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl,\n\t\t} );\n\n\n\t} else {\n\t\tmessage = wp.i18n.sprintf( wp.i18n.__( 'Originally distributed from %1$s. This %2$s has been unlinked from the original. However, you can always', 'distributor' ), dtGutenberg.originalLocationName, dtGutenberg.postTypeSingular );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'restore it.', 'distributor' ),\n\t\t\turl: dtGutenberg.linkNonceUrl\n\t\t} );\n\n\t\tactions.push( {\n\t\t\tlabel: wp.i18n. __( 'View Original', 'distributor' ),\n\t\t\turl: dtGutenberg.postUrl\n\t\t} );\n\t}\n\n\twp.data.dispatch( 'core/notices' ).createWarningNotice( message, {\n\t\tid: 'distributor-notice',\n\t\tactions,\n\t} );\n}\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/gutenberg-syndicated-post.js"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/js/push.min.js b/dist/js/push.min.js
index 5575dfdea..0bf936bef 100644
--- a/dist/js/push.min.js
+++ b/dist/js/push.min.js
@@ -1,2 +1,2 @@
-!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){e.exports=jQuery},function(e,t){e.exports=window},function(e,t){e.exports=_},,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(0),a=r(o),c=n(2),i=r(c),s=n(1),d={},u="",l=i.default.memoize(function(e){var t=document.getElementById(e);if(!t)return!1;var n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g};return i.default.template(t.innerHTML,null,n)});(0,a.default)(window).load(function(){function e(){f.classList.add("message-error"),setTimeout(function(){f.classList.remove("message-error")},6e3)}function t(t){var r=!1;i.default.each(t.internal,function(e,t){"fail"===e.status?r=!0:s.dtConnections["internal"+t].syndicated=e.url}),i.default.each(t.external,function(e,t){"fail"===e.status?r=!0:s.dtConnections["external"+t].syndicated=!0}),r?e():(f.classList.add("message-success"),p.classList.add("empty"),m.innerText="",setTimeout(function(){f.classList.remove("message-success")},6e3)),d={},n()}function n(){g.innerText="",i.default.each(s.dtConnections,function(e){if(""!==u){var t=e.name.replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase()),n=e.url.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase());if(!t&&!n)return}var r=l("dt-add-connection")({connection:e,selectedConnections:d});g.innerHTML+=r})}function r(){c.focus(),document.body.classList.toggle("distributor-show")}function o(){c.blur(),document.body.classList.toggle("distributor-show")}var c=document.querySelector("#wp-admin-bar-distributor"),f=document.querySelector("#distributor-push-wrapper");if(c&&f){var p=f.querySelector(".connections-selected"),m=f.querySelector(".selected-connections-list"),g=f.querySelector(".new-connections-list"),v=document.getElementById("dt-connection-search"),y=f.querySelector(".syndicate-button"),h=f.querySelector(".action-wrapper"),L=document.getElementById("dt-post-status"),T=document.getElementById("dt-as-draft");c.appendChild(f),(0,a.default)(c).hoverIntent(r,300,o),(0,a.default)(y).on("click",function(){if(!h.classList.contains("loading")){h.classList.add("loading");var n={action:"dt_push",nonce:s.dt.nonce,connections:d,postId:s.dt.postId};n.postStatus=null!==T&&T.checked?"draft":L.value;var r=!!s.dt.usexhr&&{withCredentials:!0};a.default.ajax({url:s.dt.ajaxurl,xhrFields:r,method:"post",data:n}).done(function(n){setTimeout(function(){if(h.classList.remove("loading"),!n.data||!n.data.results)return void e();t(n.data.results)},500)}).error(function(){setTimeout(function(){h.classList.remove("loading"),e()},500)})}}),(0,a.default)(f).on("click",".add-connection",function(e){if("A"!==e.target.nodeName&&(e.preventDefault(),!e.currentTarget.classList.contains("syndicated")))if(e.currentTarget.classList.contains("added")){var t=e.currentTarget.getAttribute("data-connection-type"),r=e.currentTarget.getAttribute("data-connection-id"),o=m.querySelector('[data-connection-id="'+r+'"][data-connection-type="'+t+'"]');o.parentNode.removeChild(o),delete d[t+r],Object.keys(d).length||p.classList.add("empty"),n()}else{var a=e.currentTarget.getAttribute("data-connection-type"),c=e.currentTarget.getAttribute("data-connection-id");d[a+c]=s.dtConnections[a+c],p.classList.remove("empty");var i=e.currentTarget.cloneNode();i.innerText=e.currentTarget.innerText;var u=document.createElement("span");u.classList.add("remove-connection"),i.appendChild(u),i.classList="added-connection",m.appendChild(i),n()}}),(0,a.default)(f).on("click",".remove-connection",function(e){e.currentTarget.parentNode.parentNode.removeChild(e.currentTarget.parentNode);var t=e.currentTarget.parentNode.getAttribute("data-connection-type"),r=e.currentTarget.parentNode.getAttribute("data-connection-id");delete d[t+r],Object.keys(d).length||p.classList.add("empty"),n()}),(0,a.default)(v).on("keyup change",i.default.debounce(function(e){""===e.currentTarget.value&&n(s.dtConnections),u=e.currentTarget.value.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,""),n()},300))}})}]);
+!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t){e.exports=jQuery},function(e,t){e.exports=window},function(e,t){e.exports=_},,,,function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var o=n(0),a=r(o),c=n(2),i=r(c),s=n(1),d={},u="",l=i.default.memoize(function(e){var t=document.getElementById(e);if(!t)return!1;var n={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g};return i.default.template(t.innerHTML,null,n)});(0,a.default)(window).on("load",function(){function e(){f.classList.add("message-error"),setTimeout(function(){f.classList.remove("message-error")},6e3)}function t(t){var r=!1;i.default.each(t.internal,function(e,t){"fail"===e.status?r=!0:s.dtConnections["internal"+t].syndicated=e.url}),i.default.each(t.external,function(e,t){"fail"===e.status?r=!0:s.dtConnections["external"+t].syndicated=!0}),r?e():(f.classList.add("message-success"),p.classList.add("empty"),m.innerText="",setTimeout(function(){f.classList.remove("message-success")},6e3)),d={},n()}function n(){g.innerText="",i.default.each(s.dtConnections,function(e){if(""!==u){var t=e.name.replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase()),n=e.url.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,"").toLowerCase().match(u.toLowerCase());if(!t&&!n)return}var r=l("dt-add-connection")({connection:e,selectedConnections:d});g.innerHTML+=r})}function r(){c.focus(),document.body.classList.toggle("distributor-show")}function o(){c.blur(),document.body.classList.toggle("distributor-show")}var c=document.querySelector("#wp-admin-bar-distributor"),f=document.querySelector("#distributor-push-wrapper");if(c&&f){var p=f.querySelector(".connections-selected"),m=f.querySelector(".selected-connections-list"),g=f.querySelector(".new-connections-list"),v=document.getElementById("dt-connection-search"),y=f.querySelector(".syndicate-button"),h=f.querySelector(".action-wrapper"),L=document.getElementById("dt-post-status"),T=document.getElementById("dt-as-draft");c.appendChild(f),(0,a.default)(c).hoverIntent(r,300,o),(0,a.default)(y).on("click",function(){if(!h.classList.contains("loading")){h.classList.add("loading");var n={action:"dt_push",nonce:s.dt.nonce,connections:d,postId:s.dt.postId};n.postStatus=null!==T&&T.checked?"draft":L.value;var r=!!s.dt.usexhr&&{withCredentials:!0};a.default.ajax({url:s.dt.ajaxurl,xhrFields:r,method:"post",data:n}).done(function(n){setTimeout(function(){if(h.classList.remove("loading"),!n.data||!n.data.results)return void e();t(n.data.results)},500)}).error(function(){setTimeout(function(){h.classList.remove("loading"),e()},500)})}}),(0,a.default)(f).on("click",".add-connection",function(e){if("A"!==e.target.nodeName&&(e.preventDefault(),!e.currentTarget.classList.contains("syndicated")))if(e.currentTarget.classList.contains("added")){var t=e.currentTarget.getAttribute("data-connection-type"),r=e.currentTarget.getAttribute("data-connection-id"),o=m.querySelector('[data-connection-id="'+r+'"][data-connection-type="'+t+'"]');o.parentNode.removeChild(o),delete d[t+r],Object.keys(d).length||p.classList.add("empty"),n()}else{var a=e.currentTarget.getAttribute("data-connection-type"),c=e.currentTarget.getAttribute("data-connection-id");d[a+c]=s.dtConnections[a+c],p.classList.remove("empty");var i=e.currentTarget.cloneNode();i.innerText=e.currentTarget.innerText;var u=document.createElement("span");u.classList.add("remove-connection"),i.appendChild(u),i.classList="added-connection",m.appendChild(i),n()}}),(0,a.default)(f).on("click",".remove-connection",function(e){e.currentTarget.parentNode.parentNode.removeChild(e.currentTarget.parentNode);var t=e.currentTarget.parentNode.getAttribute("data-connection-type"),r=e.currentTarget.parentNode.getAttribute("data-connection-id");delete d[t+r],Object.keys(d).length||p.classList.add("empty"),n()}),(0,a.default)(v).on("keyup change",i.default.debounce(function(e){""===e.currentTarget.value&&n(s.dtConnections),u=e.currentTarget.value.replace(/https?:\/\//i,"").replace(/www/i,"").replace(/[^0-9a-zA-Z ]+/,""),n()},300))}})}]);
//# sourceMappingURL=push.min.js.map
\ No newline at end of file
diff --git a/dist/js/push.min.js.map b/dist/js/push.min.js.map
index 1cd815910..449d07dd6 100644
--- a/dist/js/push.min.js.map
+++ b/dist/js/push.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap ebbc74364e6cc6835171","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/push.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","_jquery","_jquery2","_underscores","_underscores2","_window","selectedConnections","searchString","processTemplate","memoize","id","element","document","getElementById","options","evaluate","interpolate","escape","template","innerHTML","load","doError","distributorPushWrapper","classList","add","setTimeout","remove","doSuccess","results","error","each","internal","result","connectionId","status","dtConnections","syndicated","url","external","connectionsSelected","connectionsSelectedList","innerText","showConnections","connectionsNewList","connection","nameMatch","replace","toLowerCase","match","urlMatch","showConnection","distributorMenuEntered","distributorMenuItem","focus","body","toggle","distributorMenuExited","blur","querySelector","connectionsSearchInput","syndicateButton","actionWrapper","postStatusInput","asDraftInput","appendChild","hoverIntent","on","contains","data","action","nonce","dt","connections","postId","postStatus","checked","value","xhr","usexhr","withCredentials","ajax","ajaxurl","xhrFields","method","done","response","event","target","nodeName","preventDefault","currentTarget","type","getAttribute","deleteNode","parentNode","removeChild","keys","length","cloneNode","removeLink","createElement","debounce"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EACAK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QAvBA,GAAAD,KA4BAF,GAAAQ,EAAAT,EAGAC,EAAAS,EAAAP,EAGAF,EAAAU,EAAA,SAAAP,EAAAQ,EAAAC,GACAZ,EAAAa,EAAAV,EAAAQ,IACAG,OAAAC,eAAAZ,EAAAQ,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAf,GACA,GAAAQ,GAAAR,KAAAgB,WACA,WAA2B,MAAAhB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAJ,GAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtD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K,qBAE1Bb,EAAQqD,YAAamC,GACrBxF,EAAQY,UAAY,mBAEpBiB,EAAwBwB,YAAarD,GAErC+B,QAOF,EAAAxC,EAAAF,SAAQsB,GAAyB4C,GAAI,QAAS,qBAAsB,SAAEoB,GACrEA,EAAMI,cAAcI,WAAWA,WAAWC,YAAaT,EAAMI,cAAcI,WAC3E,IAAMH,GAAOL,EAAMI,cAAcI,WAAWF,aAAc,wBACpDlF,EAAO4E,EAAMI,cAAcI,WAAWF,aAAc,4BAEnDtF,GAAoBqF,EAAOjF,GAE3B5B,OAAOkH,KAAM1F,GAAsB2F,QACzC1D,EAAoBhB,UAAUC,IAAK,SAGpCkB,OAMD,EAAAxC,EAAAF,SAAQ2D,GAAyBO,GAAI,eAAgBrE,UAAEwG,SAAU,SAAEf,GAC7D,KAAOA,EAAMI,cAAcd,OAC/BlC,EAAiBP,iBAGlB5B,EAAe+E,EAAMI,cAAcd,MAAM9B,QAAS,eAAgB,IAAKA,QAAS,OAAQ,IAAKA,QAAS,iBAAkB,IAExHJ,KACE","file":"push.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */,\n/* 4 */,\n/* 5 */,\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar selectedConnections = {},\n searchString = '';\n\nvar processTemplate = _underscores2.default.memoize(function (id) {\n\tvar element = document.getElementById(id);\n\tif (!element) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tvar options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _underscores2.default.template(element.innerHTML, null, options);\n});\n\n(0, _jquery2.default)(window).load(function () {\n\tvar distributorMenuItem = document.querySelector('#wp-admin-bar-distributor');\n\tvar distributorPushWrapper = document.querySelector('#distributor-push-wrapper');\n\n\tif (!distributorMenuItem || !distributorPushWrapper) {\n\t\treturn;\n\t}\n\n\tvar connectionsSelected = distributorPushWrapper.querySelector('.connections-selected');\n\tvar connectionsSelectedList = distributorPushWrapper.querySelector('.selected-connections-list');\n\tvar connectionsNewList = distributorPushWrapper.querySelector('.new-connections-list');\n\tvar connectionsSearchInput = document.getElementById('dt-connection-search');\n\tvar syndicateButton = distributorPushWrapper.querySelector('.syndicate-button');\n\tvar actionWrapper = distributorPushWrapper.querySelector('.action-wrapper');\n\tvar postStatusInput = document.getElementById('dt-post-status');\n\tvar asDraftInput = document.getElementById('dt-as-draft');\n\n\tdistributorMenuItem.appendChild(distributorPushWrapper);\n\n\t/**\n \t * Handle UI error changes\n \t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add('message-error');\n\n\t\tsetTimeout(function () {\n\t\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\t}, 6000);\n\t}\n\n\t/**\n * Handle UI success changes\n */\n\tfunction doSuccess(results) {\n\t\tvar error = false;\n\n\t\t_underscores2.default.each(results.internal, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t});\n\n\t\t_underscores2.default.each(results.external, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t});\n\n\t\tif (error) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add('message-success');\n\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdistributorPushWrapper.classList.remove('message-success');\n\t\t\t}, 6000);\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n \t * Show connections. If there is a search string, then filter by it\n \t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_underscores2.default.each(_window.dtConnections, function (connection) {\n\t\t\tif ('' !== searchString) {\n\t\t\t\tvar nameMatch = connection.name.replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\t\t\t\tvar urlMatch = connection.url.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\n\t\t\t\tif (!nameMatch && !urlMatch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar showConnection = processTemplate('dt-add-connection')({\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t});\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t});\n\t}\n\n\t/**\n * Handle distributor push dropdown menu hover using hoverIntent.\n */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t(0, _jquery2.default)(distributorMenuItem).hoverIntent(distributorMenuEntered, 300, distributorMenuExited);\n\n\t/**\n * Do syndication ajax\n */\n\t(0, _jquery2.default)(syndicateButton).on('click', function () {\n\t\tif (actionWrapper.classList.contains('loading')) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add('loading');\n\n\t\tvar data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: _window.dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tdata.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' : postStatusInput.value;\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tif (!response.data || !response.data.results) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess(response.data.results);\n\t\t\t}, 500);\n\t\t}).error(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tdoError();\n\t\t\t}, 500);\n\t\t});\n\t});\n\n\t/**\n * Add a connection to selected connections for ajax and to the UI list.\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.add-connection', function (event) {\n\t\tif ('A' === event.target.nodeName) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif (event.currentTarget.classList.contains('syndicated')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.currentTarget.classList.contains('added')) {\n\n\t\t\tvar type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tvar deleteNode = connectionsSelectedList.querySelector('[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]');\n\n\t\t\tdeleteNode.parentNode.removeChild(deleteNode);\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tvar _type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar _id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tselectedConnections[_type + _id] = _window.dtConnections[_type + _id];\n\n\t\t\tconnectionsSelected.classList.remove('empty');\n\n\t\t\tvar element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tvar removeLink = document.createElement('span');\n\t\t\tremoveLink.classList.add('remove-connection');\n\n\t\t\telement.appendChild(removeLink);\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild(element);\n\n\t\t\tshowConnections();\n\t\t}\n\t});\n\n\t/**\n * Remove a connection from selected connections and the UI list\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.remove-connection', function (event) {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild(event.currentTarget.parentNode);\n\t\tvar type = event.currentTarget.parentNode.getAttribute('data-connection-type');\n\t\tvar id = event.currentTarget.parentNode.getAttribute('data-connection-id');\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t}\n\n\t\tshowConnections();\n\t});\n\n\t/**\n * List for connection filtering\n */\n\t(0, _jquery2.default)(connectionsSearchInput).on('keyup change', _underscores2.default.debounce(function (event) {\n\t\tif ('' === event.currentTarget.value) {\n\t\t\tshowConnections(_window.dtConnections);\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '');\n\n\t\tshowConnections();\n\t}, 300));\n});\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// push.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ebbc74364e6cc6835171","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, dtConnections } from 'window';\n\nlet selectedConnections = {},\n\tsearchString = '';\n\nconst processTemplate = _.memoize( ( id ) => {\n\tconst element = document.getElementById( id );\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tconst options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _.template( element.innerHTML, null, options );\n} );\n\njQuery( window ).load( () => {\n\tconst distributorMenuItem = document.querySelector( '#wp-admin-bar-distributor' );\n\tconst distributorPushWrapper = document.querySelector( '#distributor-push-wrapper' );\n\n\tif ( ! distributorMenuItem || ! distributorPushWrapper ) {\n\t\treturn;\n\t}\n\n\tconst connectionsSelected = distributorPushWrapper.querySelector( '.connections-selected' );\n\tconst connectionsSelectedList = distributorPushWrapper.querySelector( '.selected-connections-list' );\n\tconst connectionsNewList = distributorPushWrapper.querySelector( '.new-connections-list' );\n\tconst connectionsSearchInput = document.getElementById( 'dt-connection-search' );\n\tconst syndicateButton = distributorPushWrapper.querySelector( '.syndicate-button' );\n\tconst actionWrapper = distributorPushWrapper.querySelector( '.action-wrapper' );\n\tconst postStatusInput = document.getElementById( 'dt-post-status' );\n\tconst asDraftInput = document.getElementById( 'dt-as-draft' );\n\n\tdistributorMenuItem.appendChild( distributorPushWrapper );\n\n\t/**\n\t\t * Handle UI error changes\n\t\t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\n\t\tsetTimeout( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\t}, 6000 );\n\t}\n\n\t/**\n\t * Handle UI success changes\n\t */\n\tfunction doSuccess( results ) {\n\t\tlet error = false;\n\n\t\t_.each( results.internal, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t} );\n\n\t\t_.each( results.external, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t} );\n\n\t\tif ( error ) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add( 'message-success' );\n\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'message-success' );\n\t\t\t}, 6000 );\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n\t\t * Show connections. If there is a search string, then filter by it\n\t\t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_.each( dtConnections, ( connection ) => {\n\t\t\tif ( '' !== searchString ) {\n\t\t\t\tlet nameMatch = connection.name.replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\t\t\t\tlet urlMatch = connection.url.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\n\t\t\t\tif ( ! nameMatch && ! urlMatch ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst showConnection = processTemplate( 'dt-add-connection' )( {\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t} );\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t} );\n\t}\n\n\t/**\n\t * Handle distributor push dropdown menu hover using hoverIntent.\n\t */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tjQuery( distributorMenuItem ).hoverIntent( distributorMenuEntered, 300, distributorMenuExited );\n\n\t/**\n\t * Do syndication ajax\n\t */\n\tjQuery( syndicateButton ).on( 'click', () => {\n\t\tif ( actionWrapper.classList.contains( 'loading' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add( 'loading' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tdata.postStatus = ( null !== asDraftInput && asDraftInput.checked ) ? 'draft' : postStatusInput.value;\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tif ( ! response.data || ! response.data.results ) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess( response.data.results );\n\t\t\t}, 500 );\n\t\t} ).error( () => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tdoError();\n\t\t\t}, 500 );\n\t\t} );\n\t} );\n\n\t/**\n\t * Add a connection to selected connections for ajax and to the UI list.\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.add-connection', ( event ) => {\n\t\tif ( 'A' === event.target.nodeName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.currentTarget.classList.contains( 'syndicated' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.currentTarget.classList.contains( 'added' ) ) {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tconst deleteNode = connectionsSelectedList.querySelector( '[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]' );\n\n\t\t\tdeleteNode.parentNode.removeChild( deleteNode );\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tselectedConnections[type + id] = dtConnections[type + id];\n\n\t\t\tconnectionsSelected.classList.remove( 'empty' );\n\n\t\t\tconst element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tconst removeLink = document.createElement( 'span' );\n\t\t\tremoveLink.classList.add( 'remove-connection' );\n\n\t\t\telement.appendChild( removeLink );\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild( element );\n\n\t\t\tshowConnections();\n\t\t}\n\t} );\n\n\t/**\n\t * Remove a connection from selected connections and the UI list\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.remove-connection', ( event ) => {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild( event.currentTarget.parentNode );\n\t\tconst type = event.currentTarget.parentNode.getAttribute( 'data-connection-type' );\n\t\tconst id = event.currentTarget.parentNode.getAttribute( 'data-connection-id' );\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t}\n\n\t\tshowConnections();\n\t} );\n\n\t/**\n\t * List for connection filtering\n\t */\n\tjQuery( connectionsSearchInput ).on( 'keyup change', _.debounce( ( event ) => {\n\t\tif ( '' === event.currentTarget.value ) {\n\t\t\tshowConnections( dtConnections );\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' );\n\n\t\tshowConnections();\n\t}, 300 ) );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/push.js"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap f1938fcf27bd493f1dae","webpack:///external \"jQuery\"","webpack:///external \"window\"","webpack:///external \"_\"","webpack:///./assets/js/push.js"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","jQuery","window","_","_interopRequireDefault","obj","default","_jquery","_jquery2","_underscores","_underscores2","_window","selectedConnections","searchString","processTemplate","memoize","id","element","document","getElementById","options","evaluate","interpolate","escape","template","innerHTML","on","doError","distributorPushWrapper","classList","add","setTimeout","remove","doSuccess","results","error","each","internal","result","connectionId","status","dtConnections","syndicated","url","external","connectionsSelected","connectionsSelectedList","innerText","showConnections","connectionsNewList","connection","nameMatch","replace","toLowerCase","match","urlMatch","showConnection","distributorMenuEntered","distributorMenuItem","focus","body","toggle","distributorMenuExited","blur","querySelector","connectionsSearchInput","syndicateButton","actionWrapper","postStatusInput","asDraftInput","appendChild","hoverIntent","contains","data","action","nonce","dt","connections","postId","postStatus","checked","value","xhr","usexhr","withCredentials","ajax","ajaxurl","xhrFields","method","done","response","event","target","nodeName","preventDefault","currentTarget","type","getAttribute","deleteNode","parentNode","removeChild","keys","length","cloneNode","removeLink","createElement","debounce"],"mappings":"CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAG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,MAAM7B,QAAS,eAAgB,IAAKA,QAAS,OAAQ,IAAKA,QAAS,iBAAkB,IAExHJ,KACE","file":"push.min.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 6);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports) {\n\nmodule.exports = jQuery;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports) {\n\nmodule.exports = window;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = _;\n\n/***/ }),\n/* 3 */,\n/* 4 */,\n/* 5 */,\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _jquery = __webpack_require__(0);\n\nvar _jquery2 = _interopRequireDefault(_jquery);\n\nvar _underscores = __webpack_require__(2);\n\nvar _underscores2 = _interopRequireDefault(_underscores);\n\nvar _window = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar selectedConnections = {},\n searchString = '';\n\nvar processTemplate = _underscores2.default.memoize(function (id) {\n\tvar element = document.getElementById(id);\n\tif (!element) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tvar options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _underscores2.default.template(element.innerHTML, null, options);\n});\n\n(0, _jquery2.default)(window).on('load', function () {\n\tvar distributorMenuItem = document.querySelector('#wp-admin-bar-distributor');\n\tvar distributorPushWrapper = document.querySelector('#distributor-push-wrapper');\n\n\tif (!distributorMenuItem || !distributorPushWrapper) {\n\t\treturn;\n\t}\n\n\tvar connectionsSelected = distributorPushWrapper.querySelector('.connections-selected');\n\tvar connectionsSelectedList = distributorPushWrapper.querySelector('.selected-connections-list');\n\tvar connectionsNewList = distributorPushWrapper.querySelector('.new-connections-list');\n\tvar connectionsSearchInput = document.getElementById('dt-connection-search');\n\tvar syndicateButton = distributorPushWrapper.querySelector('.syndicate-button');\n\tvar actionWrapper = distributorPushWrapper.querySelector('.action-wrapper');\n\tvar postStatusInput = document.getElementById('dt-post-status');\n\tvar asDraftInput = document.getElementById('dt-as-draft');\n\n\tdistributorMenuItem.appendChild(distributorPushWrapper);\n\n\t/**\n \t * Handle UI error changes\n \t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add('message-error');\n\n\t\tsetTimeout(function () {\n\t\t\tdistributorPushWrapper.classList.remove('message-error');\n\t\t}, 6000);\n\t}\n\n\t/**\n * Handle UI success changes\n */\n\tfunction doSuccess(results) {\n\t\tvar error = false;\n\n\t\t_underscores2.default.each(results.internal, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t});\n\n\t\t_underscores2.default.each(results.external, function (result, connectionId) {\n\t\t\tif ('fail' === result.status) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\t_window.dtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t});\n\n\t\tif (error) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add('message-success');\n\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tdistributorPushWrapper.classList.remove('message-success');\n\t\t\t}, 6000);\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n \t * Show connections. If there is a search string, then filter by it\n \t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_underscores2.default.each(_window.dtConnections, function (connection) {\n\t\t\tif ('' !== searchString) {\n\t\t\t\tvar nameMatch = connection.name.replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\t\t\t\tvar urlMatch = connection.url.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '').toLowerCase().match(searchString.toLowerCase());\n\n\t\t\t\tif (!nameMatch && !urlMatch) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar showConnection = processTemplate('dt-add-connection')({\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t});\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t});\n\t}\n\n\t/**\n * Handle distributor push dropdown menu hover using hoverIntent.\n */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t/**\n * Handle exiting the distributor menu.\n */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle('distributor-show');\n\t}\n\n\t(0, _jquery2.default)(distributorMenuItem).hoverIntent(distributorMenuEntered, 300, distributorMenuExited);\n\n\t/**\n * Do syndication ajax\n */\n\t(0, _jquery2.default)(syndicateButton).on('click', function () {\n\t\tif (actionWrapper.classList.contains('loading')) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add('loading');\n\n\t\tvar data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: _window.dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: _window.dt.postId\n\t\t};\n\n\t\tdata.postStatus = null !== asDraftInput && asDraftInput.checked ? 'draft' : postStatusInput.value;\n\n\t\tvar xhr = _window.dt.usexhr ? { withCredentials: true } : false;\n\n\t\t_jquery2.default.ajax({\n\t\t\turl: _window.dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t}).done(function (response) {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tif (!response.data || !response.data.results) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess(response.data.results);\n\t\t\t}, 500);\n\t\t}).error(function () {\n\t\t\tsetTimeout(function () {\n\t\t\t\tactionWrapper.classList.remove('loading');\n\n\t\t\t\tdoError();\n\t\t\t}, 500);\n\t\t});\n\t});\n\n\t/**\n * Add a connection to selected connections for ajax and to the UI list.\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.add-connection', function (event) {\n\t\tif ('A' === event.target.nodeName) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif (event.currentTarget.classList.contains('syndicated')) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.currentTarget.classList.contains('added')) {\n\n\t\t\tvar type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tvar deleteNode = connectionsSelectedList.querySelector('[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]');\n\n\t\t\tdeleteNode.parentNode.removeChild(deleteNode);\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\t\tconnectionsSelected.classList.add('empty');\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tvar _type = event.currentTarget.getAttribute('data-connection-type');\n\t\t\tvar _id = event.currentTarget.getAttribute('data-connection-id');\n\n\t\t\tselectedConnections[_type + _id] = _window.dtConnections[_type + _id];\n\n\t\t\tconnectionsSelected.classList.remove('empty');\n\n\t\t\tvar element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tvar removeLink = document.createElement('span');\n\t\t\tremoveLink.classList.add('remove-connection');\n\n\t\t\telement.appendChild(removeLink);\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild(element);\n\n\t\t\tshowConnections();\n\t\t}\n\t});\n\n\t/**\n * Remove a connection from selected connections and the UI list\n */\n\t(0, _jquery2.default)(distributorPushWrapper).on('click', '.remove-connection', function (event) {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild(event.currentTarget.parentNode);\n\t\tvar type = event.currentTarget.parentNode.getAttribute('data-connection-type');\n\t\tvar id = event.currentTarget.parentNode.getAttribute('data-connection-id');\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif (!Object.keys(selectedConnections).length) {\n\t\t\tconnectionsSelected.classList.add('empty');\n\t\t}\n\n\t\tshowConnections();\n\t});\n\n\t/**\n * List for connection filtering\n */\n\t(0, _jquery2.default)(connectionsSearchInput).on('keyup change', _underscores2.default.debounce(function (event) {\n\t\tif ('' === event.currentTarget.value) {\n\t\t\tshowConnections(_window.dtConnections);\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace(/https?:\\/\\//i, '').replace(/www/i, '').replace(/[^0-9a-zA-Z ]+/, '');\n\n\t\tshowConnections();\n\t}, 300));\n});\n\n/***/ })\n/******/ ]);\n\n\n// WEBPACK FOOTER //\n// push.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f1938fcf27bd493f1dae","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 0\n// module chunks = 0 1 4 5","module.exports = window;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"window\"\n// module id = 1\n// module chunks = 0 1 2 3","module.exports = _;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"_\"\n// module id = 2\n// module chunks = 0 1","import jQuery from 'jquery';\nimport _ from 'underscores';\nimport { dt, dtConnections } from 'window';\n\nlet selectedConnections = {},\n\tsearchString = '';\n\nconst processTemplate = _.memoize( ( id ) => {\n\tconst element = document.getElementById( id );\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\t// Use WordPress style Backbone template syntax\n\tconst options = {\n\t\tevaluate: /<#([\\s\\S]+?)#>/g,\n\t\tinterpolate: /{{{([\\s\\S]+?)}}}/g,\n\t\tescape: /{{([^}]+?)}}(?!})/g\n\t};\n\n\treturn _.template( element.innerHTML, null, options );\n} );\n\njQuery( window ).on( 'load', () => {\n\tconst distributorMenuItem = document.querySelector( '#wp-admin-bar-distributor' );\n\tconst distributorPushWrapper = document.querySelector( '#distributor-push-wrapper' );\n\n\tif ( ! distributorMenuItem || ! distributorPushWrapper ) {\n\t\treturn;\n\t}\n\n\tconst connectionsSelected = distributorPushWrapper.querySelector( '.connections-selected' );\n\tconst connectionsSelectedList = distributorPushWrapper.querySelector( '.selected-connections-list' );\n\tconst connectionsNewList = distributorPushWrapper.querySelector( '.new-connections-list' );\n\tconst connectionsSearchInput = document.getElementById( 'dt-connection-search' );\n\tconst syndicateButton = distributorPushWrapper.querySelector( '.syndicate-button' );\n\tconst actionWrapper = distributorPushWrapper.querySelector( '.action-wrapper' );\n\tconst postStatusInput = document.getElementById( 'dt-post-status' );\n\tconst asDraftInput = document.getElementById( 'dt-as-draft' );\n\n\tdistributorMenuItem.appendChild( distributorPushWrapper );\n\n\t/**\n\t\t * Handle UI error changes\n\t\t */\n\tfunction doError() {\n\t\tdistributorPushWrapper.classList.add( 'message-error' );\n\n\t\tsetTimeout( () => {\n\t\t\tdistributorPushWrapper.classList.remove( 'message-error' );\n\t\t}, 6000 );\n\t}\n\n\t/**\n\t * Handle UI success changes\n\t */\n\tfunction doSuccess( results ) {\n\t\tlet error = false;\n\n\t\t_.each( results.internal, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['internal' + connectionId].syndicated = result.url;\n\t\t\t}\n\t\t} );\n\n\t\t_.each( results.external, ( result, connectionId ) => {\n\t\t\tif ( 'fail' === result.status ) {\n\t\t\t\terror = true;\n\t\t\t} else {\n\t\t\t\tdtConnections['external' + connectionId].syndicated = true;\n\t\t\t}\n\t\t} );\n\n\t\tif ( error ) {\n\t\t\tdoError();\n\t\t} else {\n\t\t\tdistributorPushWrapper.classList.add( 'message-success' );\n\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\tconnectionsSelectedList.innerText = '';\n\n\t\t\tsetTimeout( () => {\n\t\t\t\tdistributorPushWrapper.classList.remove( 'message-success' );\n\t\t\t}, 6000 );\n\t\t}\n\n\t\tselectedConnections = {};\n\n\t\tshowConnections();\n\t}\n\n\t/**\n\t\t * Show connections. If there is a search string, then filter by it\n\t\t */\n\tfunction showConnections() {\n\t\tconnectionsNewList.innerText = '';\n\n\t\t_.each( dtConnections, ( connection ) => {\n\t\t\tif ( '' !== searchString ) {\n\t\t\t\tlet nameMatch = connection.name.replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\t\t\t\tlet urlMatch = connection.url.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' ).toLowerCase().match( searchString.toLowerCase() );\n\n\t\t\t\tif ( ! nameMatch && ! urlMatch ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst showConnection = processTemplate( 'dt-add-connection' )( {\n\t\t\t\tconnection: connection,\n\t\t\t\tselectedConnections: selectedConnections\n\t\t\t} );\n\n\t\t\tconnectionsNewList.innerHTML += showConnection;\n\t\t} );\n\t}\n\n\t/**\n\t * Handle distributor push dropdown menu hover using hoverIntent.\n\t */\n\tfunction distributorMenuEntered() {\n\t\tdistributorMenuItem.focus();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\t/**\n\t * Handle exiting the distributor menu.\n\t */\n\tfunction distributorMenuExited() {\n\t\tdistributorMenuItem.blur();\n\t\tdocument.body.classList.toggle( 'distributor-show' );\n\t}\n\n\tjQuery( distributorMenuItem ).hoverIntent( distributorMenuEntered, 300, distributorMenuExited );\n\n\t/**\n\t * Do syndication ajax\n\t */\n\tjQuery( syndicateButton ).on( 'click', () => {\n\t\tif ( actionWrapper.classList.contains( 'loading' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tactionWrapper.classList.add( 'loading' );\n\n\t\tconst data = {\n\t\t\taction: 'dt_push',\n\t\t\tnonce: dt.nonce,\n\t\t\tconnections: selectedConnections,\n\t\t\tpostId: dt.postId\n\t\t};\n\n\t\tdata.postStatus = ( null !== asDraftInput && asDraftInput.checked ) ? 'draft' : postStatusInput.value;\n\n\t\tconst xhr = dt.usexhr ? { withCredentials: true } : false;\n\n\t\tjQuery.ajax( {\n\t\t\turl: dt.ajaxurl,\n\t\t\txhrFields: xhr,\n\t\t\tmethod: 'post',\n\t\t\tdata: data\n\t\t} ).done( ( response ) => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tif ( ! response.data || ! response.data.results ) {\n\t\t\t\t\tdoError();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdoSuccess( response.data.results );\n\t\t\t}, 500 );\n\t\t} ).error( () => {\n\t\t\tsetTimeout( () => {\n\t\t\t\tactionWrapper.classList.remove( 'loading' );\n\n\t\t\t\tdoError();\n\t\t\t}, 500 );\n\t\t} );\n\t} );\n\n\t/**\n\t * Add a connection to selected connections for ajax and to the UI list.\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.add-connection', ( event ) => {\n\t\tif ( 'A' === event.target.nodeName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.currentTarget.classList.contains( 'syndicated' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( event.currentTarget.classList.contains( 'added' ) ) {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tconst deleteNode = connectionsSelectedList.querySelector( '[data-connection-id=\"' + id + '\"][data-connection-type=\"' + type + '\"]' );\n\n\t\t\tdeleteNode.parentNode.removeChild( deleteNode );\n\n\t\t\tdelete selectedConnections[type + id];\n\n\t\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t\t}\n\n\t\t\tshowConnections();\n\t\t} else {\n\n\t\t\tconst type = event.currentTarget.getAttribute( 'data-connection-type' );\n\t\t\tconst id = event.currentTarget.getAttribute( 'data-connection-id' );\n\n\t\t\tselectedConnections[type + id] = dtConnections[type + id];\n\n\t\t\tconnectionsSelected.classList.remove( 'empty' );\n\n\t\t\tconst element = event.currentTarget.cloneNode();\n\t\t\telement.innerText = event.currentTarget.innerText;\n\n\t\t\tconst removeLink = document.createElement( 'span' );\n\t\t\tremoveLink.classList.add( 'remove-connection' );\n\n\t\t\telement.appendChild( removeLink );\n\t\t\telement.classList = 'added-connection';\n\n\t\t\tconnectionsSelectedList.appendChild( element );\n\n\t\t\tshowConnections();\n\t\t}\n\t} );\n\n\t/**\n\t * Remove a connection from selected connections and the UI list\n\t */\n\tjQuery( distributorPushWrapper ).on( 'click', '.remove-connection', ( event ) => {\n\t\tevent.currentTarget.parentNode.parentNode.removeChild( event.currentTarget.parentNode );\n\t\tconst type = event.currentTarget.parentNode.getAttribute( 'data-connection-type' );\n\t\tconst id = event.currentTarget.parentNode.getAttribute( 'data-connection-id' );\n\n\t\tdelete selectedConnections[type + id];\n\n\t\tif ( ! Object.keys( selectedConnections ).length ) {\n\t\t\tconnectionsSelected.classList.add( 'empty' );\n\t\t}\n\n\t\tshowConnections();\n\t} );\n\n\t/**\n\t * List for connection filtering\n\t */\n\tjQuery( connectionsSearchInput ).on( 'keyup change', _.debounce( ( event ) => {\n\t\tif ( '' === event.currentTarget.value ) {\n\t\t\tshowConnections( dtConnections );\n\t\t}\n\n\t\tsearchString = event.currentTarget.value.replace( /https?:\\/\\//i, '' ).replace( /www/i, '' ).replace( /[^0-9a-zA-Z ]+/, '' );\n\n\t\tshowConnections();\n\t}, 300 ) );\n} );\n\n\n\n// WEBPACK FOOTER //\n// ./assets/js/push.js"],"sourceRoot":""}
\ No newline at end of file
diff --git a/distributor.php b/distributor.php
index ee505115e..6d0fe1cb3 100644
--- a/distributor.php
+++ b/distributor.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: Distributor
* Description: Makes it easy to syndicate and reuse content across your websites, whether inside of a multisite or across the web.
- * Version: 1.3.6
+ * Version: 1.3.7
* Author: 10up Inc.
* Author URI: https://distributorplugin.com
* License: GPLv2 or later
@@ -17,7 +17,7 @@
exit; // Exit if accessed directly.
}
-define( 'DT_VERSION', '1.3.6' );
+define( 'DT_VERSION', '1.3.7' );
define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) );
// Define a constant if we're network activated to allow plugin to respond accordingly.
diff --git a/includes/classes/API/SubscriptionsController.php b/includes/classes/API/SubscriptionsController.php
index 45dc5f08c..10234df00 100644
--- a/includes/classes/API/SubscriptionsController.php
+++ b/includes/classes/API/SubscriptionsController.php
@@ -222,7 +222,7 @@ public function receive_item( $request ) {
// When both sides of a subscription connection support Gutenberg, update with the raw content.
$content = $request['post_data']['content'];
- if ( \Distributor\Utils\is_using_gutenberg() && $request['post_data']['distributor_raw_content'] ) {
+ if ( \Distributor\Utils\is_using_gutenberg() && isset( $request['post_data']['distributor_raw_content'] ) ) {
if ( \Distributor\Utils\dt_use_block_editor_for_post_type( $post->post_type ) ) {
$content = $request['post_data']['distributor_raw_content'];
diff --git a/includes/classes/ExternalConnections/WordPressExternalConnection.php b/includes/classes/ExternalConnections/WordPressExternalConnection.php
index c2727670f..7953258a2 100644
--- a/includes/classes/ExternalConnections/WordPressExternalConnection.php
+++ b/includes/classes/ExternalConnections/WordPressExternalConnection.php
@@ -265,6 +265,9 @@ public function remote_get( $args = array() ) {
$posts_url = untrailingslashit( $types_urls[ $post_type ] ) . '/?' . $args_str;
}
+ // Add request parameter to specify Distributor request
+ $posts_url = add_query_arg( 'distributor_request', '1', $posts_url );
+
if ( function_exists( 'vip_safe_wp_remote_get' ) && \Distributor\Utils\is_vip_com() ) {
$posts_response = vip_safe_wp_remote_get(
/**
@@ -531,7 +534,7 @@ public function push( $post_id, $args = array() ) {
$post_body = [
'title' => get_the_title( $post_id ),
'slug' => $post->post_name,
- 'content' => apply_filters( 'the_content', $post->post_content ),
+ 'content' => Utils\get_processed_content( $post->post_content ),
'type' => $post->post_type,
'status' => ( ! empty( $args['post_status'] ) ) ? $args['post_status'] : 'publish',
'excerpt' => $post->post_excerpt,
@@ -876,7 +879,11 @@ private function to_wp_post( $post ) {
$obj->ID = $post['id'];
$obj->post_title = $post['title']['rendered'];
- $obj->post_content = $post['content']['rendered'];
+
+ // Use raw content if both remote and local are using Gutenberg.
+ $obj->post_content = \Distributor\Utils\is_using_gutenberg() && isset( $post['is_using_gutenberg'] ) ?
+ $post['content']['raw'] :
+ Utils\get_processed_content( $post['content']['raw'] );
if ( isset( $post['excerpt']['raw'] ) ) {
$obj->post_excerpt = $post['excerpt']['raw'];
diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php
index 66c864c26..498eaebf5 100644
--- a/includes/classes/InternalConnections/NetworkSiteConnection.php
+++ b/includes/classes/InternalConnections/NetworkSiteConnection.php
@@ -71,7 +71,7 @@ public function push( $post_id, $args = array() ) {
$new_post_args = array(
'post_title' => get_the_title( $post_id ),
'post_name' => $post->post_name,
- 'post_content' => apply_filters( 'the_content', $post->post_content ),
+ 'post_content' => Utils\get_processed_content( $post->post_content ),
'post_excerpt' => $post->post_excerpt,
'post_type' => $post->post_type,
'post_author' => get_current_user_id(),
@@ -656,9 +656,13 @@ public static function auth_check() {
* Find out which sites user can create post type on
*
* @since 0.8
+ * @since 1.3.7 Added the `$context` parameter.
+ *
+ * @param string $context The context of the authorization.
+ *
* @return array
*/
- public static function get_available_authorized_sites() {
+ public static function get_available_authorized_sites( $context = null ) {
if ( ! is_multisite() ) {
return array();
}
@@ -667,14 +671,16 @@ public static function get_available_authorized_sites() {
* Allow plugins to override the default {@see \Distributor\InternalConnections\NetworkSiteConnection::get_available_authorized_sites()} function.
*
* @since 1.2
+ * @since 1.3.7 Added the `$context` parameter.
*
* @param array $authorized_sites {
* @type array {
* 'site' => $site, // WP_Site object.
* 'post_types' => $array, // List of post type objects the user can edit.
* }
+ * @param string $context The context of the authorization.
*/
- $authorized_sites = apply_filters( 'dt_pre_get_authorized_sites', array() );
+ $authorized_sites = apply_filters( 'dt_pre_get_authorized_sites', array(), $context );
if ( ! empty( $authorized_sites ) ) {
return $authorized_sites;
}
@@ -733,14 +739,16 @@ public static function get_available_authorized_sites() {
* Allow plugins to modify the array of authorized sites.
*
* @since 1.2
+ * @since 1.3.7 Added the `$context` parameter.
*
* @param array $authorized_sites {
* @type array {
* 'site' => $site, // WP_Site object.
* 'post_types' => $array, // List of post type objects the user can edit.
* }
+ * @param string $context The context of the authorization.
*/
- return apply_filters( 'dt_authorized_sites', $authorized_sites );
+ return apply_filters( 'dt_authorized_sites', $authorized_sites, $context );
}
/**
diff --git a/includes/pull-ui.php b/includes/pull-ui.php
index bd8d6709f..b77cf5e31 100644
--- a/includes/pull-ui.php
+++ b/includes/pull-ui.php
@@ -60,7 +60,7 @@ function setup_list_table() {
$connection_list_table = new \Distributor\PullListTable();
if ( ! empty( \Distributor\Connections::factory()->get_registered()['networkblog'] ) ) {
- $sites = \Distributor\InternalConnections\NetworkSiteConnection::get_available_authorized_sites();
+ $sites = \Distributor\InternalConnections\NetworkSiteConnection::get_available_authorized_sites( 'pull' );
foreach ( $sites as $site_array ) {
$internal_connection = new \Distributor\InternalConnections\NetworkSiteConnection( $site_array['site'] );
diff --git a/includes/push-ui.php b/includes/push-ui.php
index 6b3f66c1d..c097cab93 100644
--- a/includes/push-ui.php
+++ b/includes/push-ui.php
@@ -326,7 +326,7 @@ function menu_content() {
}
if ( ! empty( \Distributor\Connections::factory()->get_registered()['networkblog'] ) ) {
- $sites = \Distributor\InternalConnections\NetworkSiteConnection::get_available_authorized_sites();
+ $sites = \Distributor\InternalConnections\NetworkSiteConnection::get_available_authorized_sites( 'push' );
foreach ( $sites as $site_array ) {
if ( in_array( $post->post_type, $site_array['post_types'], true ) ) {
diff --git a/includes/rest-api.php b/includes/rest-api.php
index 8d7f2869a..cb36cee3b 100644
--- a/includes/rest-api.php
+++ b/includes/rest-api.php
@@ -7,6 +7,8 @@
namespace Distributor\RestApi;
+use Distributor\Utils;
+
/**
* Setup actions and filters
*
@@ -27,6 +29,7 @@ function() {
foreach ( $post_types as $post_type ) {
add_action( "rest_insert_{$post_type}", __NAMESPACE__ . '\process_distributor_attributes', 10, 3 );
add_filter( "rest_pre_insert_{$post_type}", __NAMESPACE__ . '\filter_distributor_content', 1, 2 );
+ add_filter( "rest_prepare_{$post_type}", __NAMESPACE__ . '\prepare_distributor_content', 10, 3 );
}
},
100
@@ -124,6 +127,31 @@ function process_distributor_attributes( $post, $request, $update ) {
do_action( 'dt_process_distributor_attributes', $post, $request, $update );
}
+/**
+ * Filter the data requested over REST API when a post is pulled.
+ *
+ * @param WP_REST_Response $response Response object.
+ * @param WP_Post $post Post object.
+ * @param WP_REST_Request $request Request object.
+ *
+ * @return WP_REST_Response $response The filtered response object.
+ */
+function prepare_distributor_content( $response, $post, $request ) {
+
+ // Only adjust distributor requests.
+ if ( '1' !== $request->get_param( 'distributor_request' ) ) {
+ return $response;
+ }
+ // Is the local site is running Gutenberg?
+ if ( \Distributor\Utils\is_using_gutenberg() ) {
+ $post_data = $response->get_data();
+ $post_data['is_using_gutenberg'] = true;
+ $response->set_data( $post_data );
+ }
+
+ return $response;
+}
+
/**
* We need to register distributor post fields for getting all the meta, terms, and media. This
* is easier than modifying existing fields which other plugins may depend on.
diff --git a/includes/subscriptions.php b/includes/subscriptions.php
index 7a65a9f83..574b6c524 100644
--- a/includes/subscriptions.php
+++ b/includes/subscriptions.php
@@ -8,6 +8,7 @@
namespace Distributor\Subscriptions;
use Distributor\ExternalConnection as ExternalConnection;
+use Distributor\Utils;
/**
* Setup actions and filters
@@ -263,7 +264,7 @@ function send_notifications( $post_id ) {
'title' => get_the_title( $post_id ),
'slug' => $post->post_name,
'post_type' => $post->post_type,
- 'content' => apply_filters( 'the_content', $post->post_content ),
+ 'content' => Utils\get_processed_content( $post->post_content ),
'excerpt' => $post->post_excerpt,
'distributor_media' => \Distributor\Utils\prepare_media( $post_id ),
'distributor_terms' => \Distributor\Utils\prepare_taxonomy_terms( $post_id ),
diff --git a/includes/utils.php b/includes/utils.php
index 069059c0a..2967a237b 100644
--- a/includes/utils.php
+++ b/includes/utils.php
@@ -479,7 +479,7 @@ function set_media( $post_id, $media ) {
$featured_keys = wp_list_pluck( $media, 'featured' );
// Note: this is not a strict search because of issues with typecasting in some setups
- $featured_key = array_search( true, $featured_keys );
+ $featured_key = array_search( true, $featured_keys );
$media = ( false !== $featured_key ) ? array( $media[ $featured_key ] ) : array();
}
@@ -562,7 +562,7 @@ function format_media_post( $media_post ) {
$media_item['description'] = array(
'raw' => $media_post->post_content,
- 'rendered' => apply_filters( 'the_content', $media_post->post_content ),
+ 'rendered' => get_processed_content( $media_post->post_content ),
);
$media_item['caption'] = array(
@@ -575,7 +575,7 @@ function format_media_post( $media_post ) {
$media_item['media_details'] = apply_filters( 'dt_get_media_details', wp_get_attachment_metadata( $media_post->ID ), $media_post->ID );
$media_item['post'] = $media_post->post_parent;
$media_item['source_url'] = wp_get_attachment_url( $media_post->ID );
- $media_item['meta'] = get_post_meta( $media_post->ID );
+ $media_item['meta'] = \Distributor\Utils\prepare_meta( $media_post->ID );
return apply_filters( 'dt_media_item_formatted', $media_item, $media_post->ID );
}
@@ -589,18 +589,46 @@ function format_media_post( $media_post ) {
* @return int|bool
*/
function process_media( $url, $post_id ) {
- preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $url, $matches );
+
+ /**
+ * Filter allowed media extensions to be processed
+ *
+ * @since 1.3.7
+ *
+ * @param array $allowed_extensions Allowed extensions array.
+ * @param string $url Media url.
+ * @param int $post_id Post ID.
+ */
+ $allowed_extensions = apply_filters( 'dt_allowed_media_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ), $url, $post_id );
+ preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $url, $matches );
if ( ! $matches ) {
+ $media_name = null;
+ } else {
+ $media_name = basename( $matches[0] );
+ }
+
+ /**
+ * Filter name of the processing media.
+ *
+ * @since 1.3.7
+ *
+ * @param string $media_name Name of the processing media.
+ * @param string $url Media url.
+ * @param int $post_id Post ID.
+ */
+ $media_name = apply_filters( 'dt_media_processing_filename', $media_name, $url, $post_id );
+
+ if ( is_null( $media_name ) ) {
return false;
}
+ $file_array = array();
+ $file_array['name'] = $media_name;
+
require_once ABSPATH . 'wp-admin/includes/image.php';
require_once ABSPATH . 'wp-admin/includes/file.php';
require_once ABSPATH . 'wp-admin/includes/media.php';
- $file_array = array();
- $file_array['name'] = basename( $matches[0] );
-
// Download file to temp location.
$file_array['tmp_name'] = download_url( $url );
@@ -652,3 +680,23 @@ function dt_use_block_editor_for_post_type( $post_type ) {
*/
return apply_filters( 'use_block_editor_for_post_type', true, $post_type );
}
+
+/**
+ * Helper function to process post content.
+ *
+ * @param string $post_content The post content.
+ *
+ * @return string $post_content The processed post content.
+ */
+function get_processed_content( $post_content ) {
+
+ global $wp_embed;
+ /**
+ * Remove autoembed filter so that actual URL will be pushed and not the generated markup.
+ */
+ remove_filter( 'the_content', [ $wp_embed, 'autoembed' ], 8 );
+ $post_content = apply_filters( 'the_content', $post_content );
+ add_filter( 'the_content', [ $wp_embed, 'autoembed' ], 8 );
+
+ return $post_content;
+}
diff --git a/lang/distributor.pot b/lang/distributor.pot
index 727cf005c..2c7e26b9e 100644
--- a/lang/distributor.pot
+++ b/lang/distributor.pot
@@ -1,14 +1,14 @@
-# Copyright (C) 2018 10up Inc.
+# Copyright (C) 2019 10up Inc.
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
-"Project-Id-Version: Distributor 1.3.6\n"
+"Project-Id-Version: Distributor 1.3.7\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/distributor\n"
-"POT-Creation-Date: 2018-12-19 18:06:19+00:00\n"
+"POT-Creation-Date: 2019-01-16 13:42:38+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"X-Generator: node-wp-i18n 1.2.1\n"
@@ -190,34 +190,34 @@ msgid "Delete Permanently"
msgstr ""
#: includes/classes/ExternalConnections/WordPressExternalConnection.php:188
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:299
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:686
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:302
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:689
msgid "Could not connect to API endpoint."
msgstr ""
#: includes/classes/ExternalConnections/WordPressExternalConnection.php:194
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:313
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:515
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:633
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:692
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:316
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:518
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:636
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:695
msgid "Response body is empty"
msgstr ""
#: includes/classes/ExternalConnections/WordPressExternalConnection.php:200
#: includes/classes/ExternalConnections/WordPressExternalConnection.php:206
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:523
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:526
msgid "Could not determine remote post type endpoint"
msgstr ""
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:305
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:308
msgid "API endpoint error."
msgstr ""
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:473
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:476
msgid "Post id required to push"
msgstr ""
-#: includes/classes/ExternalConnections/WordPressExternalConnection.php:641
+#: includes/classes/ExternalConnections/WordPressExternalConnection.php:644
msgid "Could not determine remote post id."
msgstr ""
@@ -645,23 +645,23 @@ msgstr ""
msgid "No connections available for distribution."
msgstr ""
-#: includes/rest-api.php:153
+#: includes/rest-api.php:181
msgid "Post meta for Distributor."
msgstr ""
-#: includes/rest-api.php:172
+#: includes/rest-api.php:200
msgid "Taxonomy terms for Distributor."
msgstr ""
-#: includes/rest-api.php:191
+#: includes/rest-api.php:219
msgid "Media for Distributor."
msgstr ""
-#: includes/rest-api.php:206
+#: includes/rest-api.php:234
msgid "Original site name for Distributor."
msgstr ""
-#: includes/rest-api.php:221
+#: includes/rest-api.php:249
msgid "Original site url for Distributor."
msgstr ""
@@ -738,7 +738,7 @@ msgstr ""
msgid "Security error!"
msgstr ""
-#: includes/subscriptions.php:324
+#: includes/subscriptions.php:325
msgid "Distributor Subscription"
msgstr ""