diff --git a/CHANGELOG.md b/CHANGELOG.md
index be1ee710e..2c3f534f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/).
+## [ 1.4.1 ] - 2019-03-15
+### Fixed
+* Improve block editor detection, correcting an issue with post saving.
+
## [ 1.4.0 ] - 2019-03-07
### Added
* Clearer instructions and help text when adding an external connection.
diff --git a/dist/css/push.min.css b/dist/css/push.min.css
index 5ebeae0d9..54b6b210e 100644
--- a/dist/css/push.min.css
+++ b/dist/css/push.min.css
@@ -1,2 +1,2 @@
-#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:" ";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:"\f335";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:" ";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
+#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:" ";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:"\f335";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:" ";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
/*# sourceMappingURL=push.min.css.map */
diff --git a/dist/css/push.min.css.map b/dist/css/push.min.css.map
index 08b94b00f..77abce9b3 100644
--- a/dist/css/push.min.css.map
+++ b/dist/css/push.min.css.map
@@ -1 +1 @@
-{"version":3,"names":[],"mappings":"","sources":["push.min.css"],"sourcesContent":["#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:\" \";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:\"\\f335\";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:\" \";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}"],"file":"push.min.css"}
\ No newline at end of file
+{"version":3,"names":[],"mappings":"","sources":["push.min.css"],"sourcesContent":["#distributor-push-wrapper{display:none}#wpadminbar #distributor-push-wrapper{display:none;font-size:13px;font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;position:absolute;top:32px;left:0;right:0;padding:2em 1em;height:auto;background-color:#32373c;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#eee;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999;-webkit-box-shadow:0 2px 1px 0 #000;box-shadow:0 2px 1px 0 #000;line-height:1.5}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{padding:2em 0}}#wpadminbar #distributor-push-wrapper *{line-height:1.5}.distributor-show #wp-admin-bar-distributor #distributor-push-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}#wpadminbar #distributor-push-wrapper .inner{width:100%;max-width:768px;margin:0 auto}#wpadminbar #distributor-push-wrapper .new-connections-list{overflow:auto;border:1px solid #555;max-height:125px}#wpadminbar #distributor-push-wrapper .selected-connections-list{margin-bottom:1em}#wpadminbar #distributor-push-wrapper .connections-selected{margin-top:2em;position:relative}#wpadminbar #distributor-push-wrapper .connections-selected .no-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected.empty{opacity:.5}#wpadminbar #distributor-push-wrapper .connections-selected.empty .no-selected{display:block}#wpadminbar #distributor-push-wrapper .connections-selected.empty .with-selected{display:none}#wpadminbar #distributor-push-wrapper .connections-selected label{color:inherit}#wpadminbar #distributor-push-wrapper .connections-selected input[type=checkbox]{vertical-align:middle;margin-right:2px}#wpadminbar #distributor-push-wrapper .connections-selected.empty:after{content:\" \";position:absolute;top:0;left:0;right:0;bottom:0;background-color:transparent}#wpadminbar #distributor-push-wrapper .syndicated-notice a{display:inline-block;padding:0;margin:0}@media (min-width:480px){#wpadminbar #distributor-push-wrapper{position:fixed}#wpadminbar #distributor-push-wrapper .connections-selector{width:60%;position:relative;float:left;padding-right:0;-webkit-box-sizing:border-box;box-sizing:border-box;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}#wpadminbar #distributor-push-wrapper .connections-selector div{width:100%}#wpadminbar #distributor-push-wrapper .connections-selected{width:40%;float:right;margin-top:0;padding-left:3em;-webkit-box-sizing:border-box;box-sizing:border-box}}#wpadminbar #distributor-push-wrapper .no-connections-notice,#wpadminbar #distributor-push-wrapper .syndicated-notice{text-align:center;margin:0}#wpadminbar #distributor-push-wrapper .no-connections-notice a,#wpadminbar #distributor-push-wrapper .syndicated-notice a{color:inherit;text-decoration:underline}#wpadminbar #distributor-push-wrapper input[type=checkbox]{height:16px!important}#wpadminbar #distributor-push-wrapper input[type=text]{font-size:inherit;padding:.5278em;width:100%;background-color:#32373c;border:2px solid #555;color:#eee;margin-bottom:.5em}#wpadminbar #distributor-push-wrapper input[type=text]::-webkit-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:-ms-input-placeholder,#wpadminbar #distributor-push-wrapper input[type=text]::-ms-input-placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]::placeholder{color:#a6a6a6}#wpadminbar #distributor-push-wrapper input[type=text]:focus{color:#eee;background-color:#32373c;border:2px solid #555}#wpadminbar #distributor-push-wrapper button{background:#0085ba;border-color:#0073aa #006799 #006799;border-width:1px;border-style:solid;-webkit-box-shadow:0 1px 0 #006799;box-shadow:0 1px 0 #006799;color:#fff;text-decoration:none;text-shadow:0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;height:30px;line-height:28px;padding:0 12px 2px;border-radius:3px;text-transform:none;font-size:13px;vertical-align:top;font-weight:400;cursor:pointer;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}#wpadminbar #distributor-push-wrapper button:focus,#wpadminbar #distributor-push-wrapper button:hover{background-color:#0085ba;outline:none}#wpadminbar #distributor-push-wrapper .new-connections-list>div:nth-child(odd){background-color:#23282d}#wpadminbar #distributor-push-wrapper .add-connection,#wpadminbar #distributor-push-wrapper .added-connection{display:block;width:100%;padding:.5em;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:pointer}#wpadminbar #distributor-push-wrapper .new-connections-list .add-connection.added{background-color:#3a4045}#wpadminbar #distributor-push-wrapper .add-connection.syndicated{cursor:default}#wpadminbar #distributor-push-wrapper .add-connection.syndicated span{color:#555}#wpadminbar #distributor-push-wrapper .add-connection.syndicated a{color:inherit;text-decoration:underline;float:right;height:auto}#wpadminbar #distributor-push-wrapper .added-connection{background-color:#555;margin-bottom:.5em;cursor:normal;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection{cursor:pointer;top:1px;display:inline-block;float:right;font-size:20px;line-height:19px;vertical-align:middle;margin-left:6px;position:relative}#wpadminbar #distributor-push-wrapper .added-connection .remove-connection:after{content:\"\\f335\";font-family:dashicons}#wpadminbar #distributor-push-wrapper header,#wpadminbar #distributor-push-wrapper p{margin:0 0 1em!important;padding:0}#wpadminbar #distributor-push-wrapper .as-draft{margin-left:.5em;height:30px;line-height:28px;padding:2px 12px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box}#wpadminbar #distributor-push-wrapper .action-wrapper.loading .syndicate-button:after{content:\" \";vertical-align:middle;border-radius:50%;width:6px;margin-left:8px;height:6px;display:inline-block;font-size:9px;text-indent:-9999em;border-top:3px solid #cfcfcf;border-right:3px solid #cfcfcf;border-bottom:3px solid #cfcfcf;border-left:3px solid #00aef2;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:a 1.1s infinite linear;animation:a 1.1s infinite linear;position:relative;top:-1px;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-box-sizing:initial;box-sizing:initial}#wpadminbar #distributor-push-wrapper .messages{margin-top:1em;-webkit-box-sizing:border-box;box-sizing:border-box}@media (min-width:480px){#wpadminbar #distributor-push-wrapper .messages{width:40%;float:right;clear:right;padding-left:3em}}#wpadminbar #distributor-push-wrapper .messages *{display:none}#wpadminbar #distributor-push-wrapper.message-error .messages .dt-error,#wpadminbar #distributor-push-wrapper.message-success .messages .dt-success{display:block}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}"],"file":"push.min.css"}
\ 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 9d73c6af3..af1074d76 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 fff10cbf8520b51427a4","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,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AAQ,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 fff10cbf8520b51427a4","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
+{"version":3,"sources":["webpack:///admin-external-connection.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","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","_window","dt","endpoint_checking_message","auth","_underscores2","each","authFields","authField","disabled","key","getAttribute","postId","postIdField","_jquery2","ajax","url","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","_underscores","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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,SAAQ+G,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 fff10cbf8520b51427a4","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/gutenberg-status-plugin.min.js.map b/dist/js/gutenberg-status-plugin.min.js.map
index 88b813056..4d96f4f94 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 fff10cbf8520b51427a4","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 fff10cbf8520b51427a4","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
+{"version":3,"sources":["webpack:///gutenberg-status-plugin.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","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,KAAuB8B,EAAAC,GAAGC,SAASC,qBAAuB,IACtDC,GAAmBJ,EAAAC,GAAGI,QAAtBD,eACAE,EAAON,EAAAC,GAAGM,KAAVD,GACAH,EAAyBH,EAAAC,GAAGC,SAA5BC,qBAKFK,EAAwB,WAC7B,MACCC,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,oBACNL,EAAI,oBACNG,MAAAC,cAAA,kBAAWV,EAAAY,YAAYC,gBAAvB,QASEC,EAAsB,WAC3B,MACCL,OAAAC,cAACP,EAAD,KACCM,MAAAC,cAAA,QAAMC,GAAG,kBACNX,EAAAC,GAAGM,KAAKQ,QAASf,EAAAC,GAAGM,KAAKD,GAAI,sCAAuC,eACrEN,EAAAY,YAAYI,iBACZ,MAAQhB,EAAAY,YAAYI,iBAAmB,GAAK,OAM5C,GAAIC,SAAUjB,EAAAY,YAAYI,kBAC9BZ,EAAgB,4BAA8Bc,OAAQJ,IAC3C,IAAMG,SAAUjB,EAAAY,YAAYC,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 fff10cbf8520b51427a4","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 3c204c917..ddb760d59 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 fff10cbf8520b51427a4","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,G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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 fff10cbf8520b51427a4","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 fff10cbf8520b51427a4","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,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B,YAvBlBb,EAAUP,EAAAC,GAAGC,KAAKS,QAASX,EAAAC,GAAGC,KAAKU,GAAI,gEAAiE,eAAiBZ,EAAAI,YAAYU,sBAErIN,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAMU,GAAI,wBAAyB,eAC7CM,IAAKlB,EAAAI,YAAYiB,iBAGlBb,EAAQQ,MACPC,MAAOjB,EAAAC,GAAGC,KAAKU,GAAI,gBAAiB,eACpCM,IAAKlB,EAAAI,YAAYgB,WAkBnBpB,EAAAC,GAAGqB,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 fff10cbf8520b51427a4","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.map b/dist/js/push.min.js.map
index 5452a1763..9bca0aaf6 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 fff10cbf8520b51427a4","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,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,GJoFO,CACA,CACA,CAED,SAAUzB,EAAQD,EAASH,GAEjC,YAaA,SAAS8B,GAAuBC,GAAO,MAAOA,IAAOA,EAAIX,WAAaW,GAAQC,QAASD,GKvGvF,GAAAE,GAAAjC,EAAA,GL+FIkC,EAAWJ,EAAuB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OiH,KAAMzF,GAAsB0F,QACzCzD,EAAoBhB,UAAUC,IAAK,SAGpCkB,OAMD,EAAAxC,EAAAF,SAAQ2D,GAAyBvC,GAAI,eAAgBvB,UAAEuG,SAAU,SAAEf,GAC7D,KAAOA,EAAMI,cAAcd,OAC/BjC,EAAiBP,iBAGlB5B,EAAe8E,EAAMI,cAAcd,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 fff10cbf8520b51427a4","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
+{"version":3,"sources":["webpack:///push.min.js","webpack:///webpack/bootstrap fff10cbf8520b51427a4","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,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,E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B,cAAe,wBAA0BhD,EAAK,4BAA8BgF,EAAO,KAE9HE,GAAWC,WAAWC,YAAaF,SAE5BtF,GAAoBoF,EAAOhF,GAE3B5B,OAAOiH,KAAMzF,GAAsB0F,QACzCzD,EAAoBhB,UAAUC,IAAK,SAGpCkB,QACM,CAEN,GAAMgD,GAAOL,EAAMI,cAAcE,aAAc,wBACzCjF,EAAO2E,EAAMI,cAAcE,aAAc,qBAE/CrF,GAAoBoF,EAAOhF,GAAML,EAAA8B,cAAcuD,EAAOhF,GAEtD6B,EAAoBhB,UAAUG,OAAQ,QAEtC,IAAMf,GAAgB0E,EAAMI,cAAcQ,WAC1CtF,GAAQ8B,UAAY4C,EAAMI,cAAchD,SAExC,IAAMyD,GAAatF,SAASuF,cAAe,OAC3CD,GAAW3E,UAAUC,IAAK,qBAE1Bb,EAAQqD,YAAakC,GACrBvF,EAAQY,UAAY,mBAEpBiB,EAAwBwB,YAAarD,GAErC+B,QAOF,EAAAxC,EAAAF,SAAQsB,GAAyBF,GAAI,QAAS,qBAAsB,SAAEiE,GACrEA,EAAMI,cAAcI,WAAWA,WAAWC,YAAaT,EAAMI,cAAcI,WAC3E,IAAMH,GAAOL,EAAMI,cAAcI,WAAWF,aAAc,wBACpDjF,EAAO2E,EAAMI,cAAcI,WAAWF,aAAc,4BAEnDrF,GAAoBoF,EAAOhF,GAE3B5B,OAAOiH,KAAMzF,GAAsB0F,QACzCzD,EAAoBhB,UAAUC,IAAK,SAGpCkB,OAMD,EAAAxC,EAAAF,SAAQ2D,GAAyBvC,GAAI,eAAgBhB,EAAAJ,QAAEoG,SAAU,SAAEf,GAC7D,KAAOA,EAAMI,cAAcd,OAC/BjC,mBAGDnC,EAAe8E,EAAMI,cAAcd,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 fff10cbf8520b51427a4","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 5e7a0c725..de96a55ab 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.4.0
+ * Version: 1.4.1
* 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.4.0' );
+define( 'DT_VERSION', '1.4.1' );
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/utils.php b/includes/utils.php
index 24b3631b2..e656617a4 100644
--- a/includes/utils.php
+++ b/includes/utils.php
@@ -55,7 +55,28 @@ function is_using_gutenberg( $post ) {
return false;
}
- return use_block_editor_for_post( $post );
+ /**
+ * WordPress 5.0 will do a check_admin_referrer() inside the use_block_editor_for_posts(),
+ * and this call would fail, returns a 404 if there's custom meta box, and kills the request.
+ *
+ * Unsetting the 'meta-box-loader' in the global request would bypass that check.
+ */
+ if ( isset( $_GET['meta-box-loader'] ) ) {
+ $meta_box_loader = $_GET['meta-box-loader'];
+ unset( $_GET['meta-box-loader'] );
+ }
+
+ $use_block_editor = use_block_editor_for_post( $post );
+
+ /**
+ * Set the $meta_box_loader back to the request, if it exists
+ * so other areas that rely on it would still work.
+ */
+ if ( isset( $meta_box_loader ) ) {
+ $_GET['meta-box-loader'] = $meta_box_loader;
+ }
+
+ return $use_block_editor;
}
diff --git a/lang/distributor.pot b/lang/distributor.pot
index 96c509e9e..358c8fb0f 100644
--- a/lang/distributor.pot
+++ b/lang/distributor.pot
@@ -2,16 +2,16 @@
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
-"Project-Id-Version: Distributor 1.4.0\n"
+"Project-Id-Version: Distributor 1.4.1\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/distributor\n"
-"POT-Creation-Date: 2019-03-08 15:35:57+00:00\n"
+"POT-Creation-Date: 2019-03-15 18:33: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: 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"
+"X-Generator: node-wp-i18n 1.1.1\n"
#: distributor.php:63
msgid "Distributor requires PHP version 5.6."