mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-25 09:44:32 +01:00
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
!function(){"use strict";var t={6705:function(t,e,n){var o=n(2667),r=(n(2004),n(8407),n(4458),n(5101),n(6394),n(2322),n(4669),n(9268),n(3233),n(5466)),i=n(3074),a=n.n(i),u=n(1346),s=n(2880),l=n(365),c=n(137),f=n.n(c),h=n(4426),p=n(2259),m=n(612),d=n(5464),b=n(8170),y=n(8349),v=n(3085),g=(n(9174),n(9688)),_=n(8420);function S(t){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function w(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function k(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function E(t,e,n){return e&&k(t.prototype,e),n&&k(t,n),t}function P(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&&j(t,e)}function j(t,e){return(j=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function D(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=O(t);if(e){var r=O(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return C(this,n)}}function C(t,e){return!e||"object"!==S(e)&&"function"!=typeof e?x(t):e}function x(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function O(t){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var F=function(t){P(n,t);var e=D(n);function n(t){var o;return w(this,n),(o=e.call(this,t)).state={subject:"",body:"",isSending:!1},o.onUpdateSubject=o.onUpdateSubject.bind(x(o)),o.onUpdateBody=o.onUpdateBody.bind(x(o)),o.onSubmit=o.onSubmit.bind(x(o)),o.onSubmitSuccess=o.onSubmitSuccess.bind(x(o)),o.onSubmitFail=o.onSubmitFail.bind(x(o)),o}return E(n,[{key:"onUpdateSubject",value:function(){this.setState({subject:this.refs.msgSubject.value.trim()})}},{key:"onUpdateBody",value:function(){this.setState({body:this.refs.msgBody.value.trim()})}},{key:"onSubmitSuccess",value:function(t){this.setState({subject:"",body:"",isSending:!1},(function(){setTimeout(function(){y.wN("Your message was successfully submitted to "+this.props.author.name,"messageSubmitSucceed")}.bind(this),100)}))}},{key:"onSubmitFail",value:function(t){this.setState({isSending:!1},(function(){console.log(t),setTimeout(function(){y.wN("Your message failed to submit. Please try again","messageSubmitFailed")}.bind(this),100)}))}},{key:"onSubmit",value:function(t){this.state.isSending||""===this.state.subject||""===this.state.body||(t.preventDefault(),t.stopPropagation(),this.setState({isSending:!0},(function(){var t=u.Z._currentValue.users+"/"+this.props.author.username+"/contact";(0,_.j0)(t,{subject:this.state.subject,body:this.state.body},{headers:{"X-CSRFToken":(0,_.m5)()}},!1,this.onSubmitSuccess,this.onSubmitFail)})))}},{key:"render",value:function(){return r.createElement("div",{className:"media-list-row profile-contact"},r.createElement("div",{className:"media-list-header"},r.createElement("h2",null,"Contact")),r.createElement("form",{method:"post",className:"user-contact-form"+(this.state.isSending?" pending-response":"")},r.createElement("span",null,r.createElement("label",null,"Subject"),r.createElement("input",{ref:"msgSubject",type:"text",required:!0,onChange:this.onUpdateSubject,value:this.state.subject})),r.createElement("span",null,r.createElement("label",null,"Message"),r.createElement("textarea",{ref:"msgBody",required:!0,cols:"40",rows:"10",onChange:this.onUpdateBody,value:this.state.body})),r.createElement("button",{onClick:this.onSubmit},"SUBMIT")))}}]),n}(r.PureComponent),R=function(t){P(n,t);var e=D(n);function n(t){var o;return w(this,n),(o=e.call(this,t,"author-about")).userIsAuthor=null,o.enabledContactForm=!1,o}return E(n,[{key:"pageContent",value:function(){var t=null,e=[],n=[];if(this.state.author){var o,i;if(null===this.userIsAuthor&&(s.Z._currentValue.is.anonymous?(this.userIsAuthor=!1,this.enabledContactForm=!1):(this.userIsAuthor=b.Z.get("author-data").username===s.Z._currentValue.username,this.enabledContactForm=!this.userIsAuthor&&s.Z._currentValue.can.contactUser)),void 0!==this.state.author.description&&this.state.author.description&&""!==this.state.author.description&&(t=this.state.author.description),void 0!==this.state.author.location_info&&this.state.author.location_info.length){var a=[];for(o=0;o<this.state.author.location_info.length;)void 0!==this.state.author.location_info[o].title&&void 0!==this.state.author.location_info[o].url&&a.push(r.createElement("a",{key:o,href:(0,g.U)(this.state.author.location_info[o].url,l.Z._currentValue.url),title:this.state.author.location_info[o].title},this.state.author.location_info[o].title)),o+=1;e.push(r.createElement("li",{key:"location"},r.createElement("span",null,"Location:"),r.createElement("span",null,a)))}else void 0!==this.state.author.location&&this.state.author.location&&""!==this.state.author.location&&e.push(r.createElement("li",{key:"location"},r.createElement("span",null,"Location:"),r.createElement("span",null,this.state.author.location)));if(void 0!==this.state.author.home_page&&this.state.author.home_page&&""!==this.state.author.home_page&&""!==(i=f()(this.state.author.home_page.trim()).toString())&&e.push(r.createElement("li",{key:"website"},r.createElement("span",null,"Website:"),r.createElement("span",null,i))),void 0!==this.state.author.social_media_links&&this.state.author.social_media_links&&""!==this.state.author.social_media_links){var u=this.state.author.social_media_links.split(",");if(u.length){for(o=0;o<u.length;)""!==(i=u[o].trim())&&n.push(r.createElement("span",{key:o},i)),o+=1;e.push(r.createElement("li",{key:"social_media"},r.createElement("span",null,"Social media:"),r.createElement("span",{className:"author-social-media"},n)))}}}return[this.state.author?r.createElement(m.Z,{key:"ProfilePagesHeader",author:this.state.author,type:"about"}):null,this.state.author?r.createElement(d.Z,{key:"ProfilePagesContent",enabledContactForm:this.enabledContactForm},r.createElement("div",{className:"media-list-wrapper items-list-ver profile-about-content "},null===t&&0<e.length?null:h.Z.get("config-options").pages.profile.htmlInDescription?r.createElement(v.G,{title:this.props.title},r.createElement("span",{dangerouslySetInnerHTML:{__html:t||null}})):r.createElement(v.G,{title:this.props.title},t),e.length?r.createElement(v.G,{title:"Details"},r.createElement("ul",{className:"profile-details"},e)):null,this.enabledContactForm?r.createElement(F,{author:this.state.author}):null)):null]}}]),n}(p.G);R.propTypes={title:a().string.isRequired},R.defaultProps={title:"Biography"},(0,o.X)("page-profile-about",R)},1346:function(t,e,n){var o=n(5466),r=n(4547),i=o.createContext((0,r.v)(window.MediaCMS).api);i.Consumer,e.Z=i},2880:function(t,e,n){var o=n(5466),r=n(4547),i=o.createContext((0,r.v)(window.MediaCMS).member);i.Consumer,e.Z=i},6203:function(t,e,n){n(2322),n(9268),n(3233),e.Z=function(){var t,e,n,o=null;if(document.cookie&&""!==document.cookie)for(e=document.cookie.split(";"),t=0;t<e.length;){if("csrftoken="===(n=e[t].trim()).substring(0,10)){o=decodeURIComponent(n.substring(10));break}t+=1}return o}},8420:function(t,e,n){n.d(e,{A_:function(){return o.Z},j0:function(){return r.Z},GH:function(){return i.Z},Jl:function(){return a.Z},v$:function(){return u.Z},uf:function(){return s.Z},$4:function(){return l.Z},m5:function(){return c.Z}});var o=n(1712),r=n(9752),i=n(84),a=n(9009),u=n(1438),s=n(4135),l=n(3140),c=(n(1752),n(7514),n(1569),n(6203));n(7188)},9752:function(t,e,n){n(6394),n(5334),n(7588);var o=n(4559);function r(t,e,n,o,r,i,a){try{var u=t[i](a),s=u.value}catch(t){return void n(t)}u.done?e(s):Promise.resolve(s).then(o,r)}function i(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function u(t){r(a,o,i,u,s,"next",t)}function s(t){r(a,o,i,u,s,"throw",t)}u(void 0)}))}}function a(){return(a=i(regeneratorRuntime.mark((function t(e,n,r,i,a,u){var s,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l=function(t){u instanceof Function&&u(t)},s=function(t){a instanceof Function&&a(t)},n=n||{},!i){t.next=8;break}return t.next=6,(0,o.post)(e,n,r||null).then(s).catch(l||null);case 6:t.next=9;break;case 8:(0,o.post)(e,n,r||null).then(s).catch(l||null);case 9:case"end":return t.stop()}}),t)})))).apply(this,arguments)}n(6028),e.Z=function(t,e,n,o,r,i){return a.apply(this,arguments)}},8170:function(t,e,n){n(4458),n(5101),n(2322),n(9006),n(9268),n(5466);var o=n(1590),r=n.n(o),i=n(8420),a=(n(4426),n(4547));function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e){return!e||"object"!==u(e)&&"function"!=typeof e?f(t):e}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var p=function(t){!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&&l(t,e)}(p,t);var e,n,o,r,u=(o=p,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=h(o);if(r){var n=h(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return c(this,t)});function p(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),(t=u.call(this)).mediacms_config=(0,a.v)(window.MediaCMS),t.authorData=null,t.authorQuery=void 0,t.onDataLoad=t.onDataLoad.bind(f(t)),t.onDataLoadFail=t.onDataLoadFail.bind(f(t)),t.removeProfileResponse=t.removeProfileResponse.bind(f(t)),t.removeProfileFail=t.removeProfileFail.bind(f(t)),t.removingProfile=!1,t}return e=p,(n=[{key:"removeProfileResponse",value:function(t){t&&204===t.status&&this.emit("profile_delete",this.authorData.username)}},{key:"removeProfileFail",value:function(){this.emit("profile_delete_fail",this.authorData.username),setTimeout((function(t){this.removingProfile=!1}),100,this)}},{key:"get",value:function(t){switch(t){case"author-data":return this.authorData;case"author-query":if(void 0===this.authorQuery){this.authorQuery=null;var e=window.location.search;if(e&&""!==e){e=e.split("?")[1].split("=");for(var n=0;n<e.length;){if("aq"===e[n]){this.authorQuery=e[n+1]||null;break}n+=1}}}return this.authorQuery}}},{key:"onDataLoad",value:function(t){t&&t.data&&(this.authorData=t.data,this.authorData.id=this.authorData.username,this.authorData.name=""!==this.authorData.name?this.authorData.name:this.authorData.username,this.emit("load-author-data"))}},{key:"onDataLoadFail",value:function(t){}},{key:"actions_handler",value:function(t){switch(t.type){case"REMOVE_PROFILE":if(this.removingProfile)return;this.removingProfile=!0;var e=this.mediacms_config.api.users+"/"+this.authorData.username;(0,i.Jl)(e,{headers:{"X-CSRFToken":(0,i.m5)()}},!1,this.removeProfileResponse,this.removeProfileFail);break;case"LOAD_AUTHOR_DATA":(0,i.A_)(this.mediacms_config.api.users+"/"+window.MediaCMS.profileId,!1,this.onDataLoad,this.onDataLoadFail)}}}])&&s(e.prototype,n),p}(r());e.Z=(0,i.v$)(new p,"actions_handler")},9174:function(t,e,n){n.d(e,{_:function(){return u}});var o=n(5466),r=n(3074),i=n.n(r),a=n(3085);function u(t){return o.createElement("div",{className:(void 0===t.className||null===t.className?"":t.className+" ")+"media-list-wrapper",style:t.style},o.createElement(a.G,{title:t.title,viewAllLink:t.viewAllLink,viewAllText:t.viewAllText},t.children||null))}u.propTypes={style:i().object,className:i().string}}},e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={exports:{}};return t[o].call(r.exports,r,r.exports,n),r.exports}n.m=t,n.x=function(){},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.j=797,function(){var t={797:0},e=[[6705,431]],o=function(){},r=function(r,i){for(var a,u,s=i[0],l=i[1],c=i[2],f=i[3],h=0,p=[];h<s.length;h++)u=s[h],n.o(t,u)&&t[u]&&p.push(t[u][0]),t[u]=0;for(a in l)n.o(l,a)&&(n.m[a]=l[a]);for(c&&c(n),r&&r(i);p.length;)p.shift()();return f&&e.push.apply(e,f),o()},i=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[];function a(){for(var o,r=0;r<e.length;r++){for(var i=e[r],a=!0,u=1;u<i.length;u++){var s=i[u];0!==t[s]&&(a=!1)}a&&(e.splice(r--,1),o=n(n.s=i[0]))}return 0===e.length&&(n.x(),n.x=function(){}),o}i.forEach(r.bind(null,0)),i.push=r.bind(null,i.push.bind(i));var u=n.x;n.x=function(){return n.x=u||function(){},(o=a)()}}(),n.x()}(); |