File "coauthors-migration.min.js"
Full path: /home/webcknlt/admissiontell.com/wp-content/plugins/publishpress-authors/src/assets/js/coauthors-migration.min.js
File
size: 8.31 B (8.31 KB bytes)
MIME-type: text/plain
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=13)}([function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e,r){var n=r(6),o=r(0);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?o(t):e}},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},function(t,e,r){var n=r(7);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},,,,,,function(t,e,r){"use strict";r.r(e);var n=r(1),o=r.n(n),a=r(2),i=r.n(a),s=r(3),u=r.n(s),c=r(4),l=r.n(c),p=r(0),g=r.n(p),f=r(5),h=r.n(f),d=function(t){function e(t){var r;return o()(this,e),(r=u()(this,l()(e).call(this,t))).renderDeactivatePluginOption=r.renderDeactivatePluginOption.bind(g()(r)),r.renderProgressBar=r.renderProgressBar.bind(g()(r)),r.renderLog=r.renderLog.bind(g()(r)),r.deactivateCoAuthorsPlus=r.deactivateCoAuthorsPlus.bind(g()(r)),r.startMigration=r.startMigration.bind(g()(r)),r.clickStart=r.clickStart.bind(g()(r)),r.reset=r.reset.bind(g()(r)),r.migrateChunkOfData=r.migrateChunkOfData.bind(g()(r)),r.getCoAuthorsMigrationInitialData=r.getCoAuthorsMigrationInitialData.bind(g()(r)),r.state={totalToMigrate:0,totalMigrated:0,inProgress:!1,chunkSize:r.props.chunkSize,progress:0,log:"",showDeactivateOption:!1,disablingCoAuthors:!1},r}return h()(e,t),i()(e,[{key:"clickStart",value:function(t){t.preventDefault(),this.startMigration()}},{key:"getCoAuthorsMigrationInitialData",value:function(t){var e=this;this.setState({log:ppmaCoAuthorsMigration.start_message}),window.setTimeout((function(){jQuery.ajax({type:"GET",dataType:"json",url:ajaxurl,async:!1,data:{action:"get_coauthors_migration_data",nonce:e.props.nonce},success:function(r){e.setState({totalToMigrate:r.total}),t()},error:function(t,r,n){e.setState({progress:0,inProgress:!1,log:ppmaCoAuthorsMigration.error_message+n+" ["+r+"]",showDeactivateOption:!1})}})}),1e3)}},{key:"finishCoAuthorsMigration",value:function(t){var e=this;this.setState({progress:99,log:ppmaCoAuthorsMigration.progress_message}),window.setTimeout((function(){jQuery.ajax({type:"GET",dataType:"json",url:ajaxurl,async:!1,data:{action:"finish_coauthors_migration",nonce:e.props.nonce},success:function(){t()},error:function(t,r,n){e.setState({progress:0,inProgress:!1,log:ppmaCoAuthorsMigration.error_message+n+" ["+r+"]",showDeactivateOption:!1})}})}),1e3)}},{key:"migrateChunkOfData",value:function(){var t=this;jQuery.ajax({type:"GET",dataType:"json",url:ajaxurl,data:{action:"migrate_coauthors",nonce:t.props.nonce,chunkSize:t.state.chunkSize},success:function(){var e=t.state.totalMigrated+t.state.chunkSize;e>t.state.totalToMigrate&&(e=t.state.totalToMigrate),t.setState({totalMigrated:e,progress:2+Math.floor(98/t.state.totalToMigrate*e)}),e<t.state.totalToMigrate?t.migrateChunkOfData():t.finishCoAuthorsMigration((function(){t.setState({progress:100,log:ppmaCoAuthorsMigration.completed_message,showDeactivateOption:!0}),window.setTimeout((function(){t.setState({inProgress:!1})}),1e3)}))},error:function(e,r,n){t.setState({progress:0,inProgress:!1,log:ppmaCoAuthorsMigration.error_message+n+" ["+r+"]",showDeactivateOption:!1})}})}},{key:"startMigration",value:function(){var t=this;this.setState({progress:1,inProgress:!0,log:ppmaCoAuthorsMigration.wait_message,showDeactivateOption:!1}),window.setTimeout((function(){t.getCoAuthorsMigrationInitialData((function(){t.setState({progress:2,log:ppmaCoAuthorsMigration.copying_message}),t.migrateChunkOfData()}))}),1e3)}},{key:"deactivateCoAuthorsPlus",value:function(){var t=this;this.setState({disablingCoAuthors:!0,log:ppmaCoAuthorsMigration.deactivating_message}),jQuery.ajax({type:"GET",dataType:"json",url:ajaxurl,data:{action:"deactivate_coauthors_plus",nonce:t.props.nonce},success:function(){t.setState({disablingCoAuthors:!1,log:ppmaCoAuthorsMigration.deactivated_message,showDeactivateOption:!1})},error:function(e,r,n){t.setState({disablingCoAuthors:!1,log:ppmaCoAuthorsMigration.error_message+n+" ["+r+"]"})}})}},{key:"renderDeactivatePluginOption",value:function(){var t=ppmaCoAuthorsMigration.deactivate_message,e=!this.state.disablingCoAuthors;return wp.element.createElement(m,{label:t,onClick:this.deactivateCoAuthorsPlus,enabled:e})}},{key:"reset",value:function(){this.setState({progress:0,inProgress:!1})}},{key:"renderProgressBar",value:function(){return wp.element.createElement(y,{value:this.state.progress})}},{key:"renderLog",value:function(){return wp.element.createElement(v,{log:this.state.log,show:this.state.showDeactivateOption})}},{key:"render",value:function(){var t=!this.state.inProgress,e=this.state.inProgress?this.renderProgressBar():"",r=""==this.state.log?"":this.renderLog(),n=this.state.showDeactivateOption?this.renderDeactivatePluginOption():"";return wp.element.createElement("div",null,wp.element.createElement(m,{label:ppmaCoAuthorsMigration.copy_message,onClick:this.startMigration,enabled:t}),n,e,r)}}]),e}(React.Component),m=function(t){function e(t){return o()(this,e),u()(this,l()(e).call(this,t))}return h()(e,t),i()(e,[{key:"render",value:function(){var t=!this.props.enabled;return wp.element.createElement("input",{type:"button",className:"button button-secondary button-danger ppma_maintenance_button",onClick:this.props.onClick,disabled:t,value:this.props.label})}}]),e}(React.Component),v=function(t){function e(t){return o()(this,e),u()(this,l()(e).call(this,t))}return h()(e,t),i()(e,[{key:"render",value:function(){return wp.element.createElement("div",null,wp.element.createElement("div",{class:"ppma_maintenance_log",readOnly:!0},this.props.log))}}]),e}(React.Component),y=function(t){function e(t){return o()(this,e),u()(this,l()(e).call(this,t))}return h()(e,t),i()(e,[{key:"renderLabel",value:function(){return wp.element.createElement("div",{className:"p-progressbar-label"},this.props.value," %")}},{key:"render",value:function(){var t=this.renderLabel();return wp.element.createElement("div",{role:"progressbar",id:this.props.id,className:"p-progressbar p-component p-progressbar-determinate",style:this.props.style,"aria-valuemin":"0","aria-valuenow":this.props.value,"aria-valuemax":"100","aria-label":this.props.value},wp.element.createElement("div",{className:"p-progressbar-value p-progressbar-value-animate",style:{width:this.props.value+"%",display:"block"}}),t)}}]),e}(React.Component);jQuery((function(){ReactDOM.render(wp.element.createElement(d,{notMigratedPostsId:ppmaCoAuthorsMigration.notMigratedPostsId,nonce:ppmaCoAuthorsMigration.nonce,chunkSize:5}),document.getElementById("publishpress-authors-coauthors-migration"))}))}]);