mediacms/static/js/profile-about.js

1 line
37 KiB
JavaScript
Raw Permalink Normal View History

2024-10-04 12:17:40 +02:00
!function(){var t,e={4254:function(t,e,n){"use strict";var r=n(2541),o=(n(3233),n(4458),n(5101),n(2004),n(8407),n(6394),n(4669),n(2322),n(9268),n(3080),n(8288),n(5677),n(2129),n(4655),n(5466)),i=n(3074),a=n.n(i),u=n(137),c=n.n(u),l=n(3613),s=n(473),f=n(541),p=n(8578),m=n(8556),d=n(6970),y=n(7180),h=n(4982),b=n(1283);function v(t){return(v="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 g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function w(t,e,n){return e&&S(t.prototype,e),n&&S(t,n),t}function E(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&&k(t,e)}function k(t,e){return(k=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function O(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 Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=j(t);if(e){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return A(this,n)}}function A(t,e){return!e||"object"!==v(e)&&"function"!=typeof e?P(t):e}function P(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j(t){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var _=function(t){E(n,t);var e=O(n);function n(t){var r;return g(this,n),(r=e.call(this,t)).state={subject:"",body:"",isSending:!1},r.onUpdateSubject=r.onUpdateSubject.bind(P(r)),r.onUpdateBody=r.onUpdateBody.bind(P(r)),r.onSubmit=r.onSubmit.bind(P(r)),r.onSubmitSuccess=r.onSubmitSuccess.bind(P(r)),r.onSubmitFail=r.onSubmitFail.bind(P(r)),r}return w(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(){f.PageActions.addNotification("Your message was successfully submitted to "+this.props.author.name,"messageSubmitSucceed")}.bind(this),100)}))}},{key:"onSubmitFail",value:function(t){this.setState({isSending:!1},(function(){b.log(t),setTimeout(function(){f.PageActions.addNotification("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=l.ApiUrlContext._currentValue.users+"/"+this.props.author.username+"/contact";(0,s.postRequest)(t,{subject:this.state.subject,body:this.state.body},{headers:{"X-CSRFToken":(0,s.csrfToken)()}},!1,this.onSubmitSuccess,this.onSubmitFail)})))}},{key:"render",value:function(){return o.createElement("div",{className:"media-list-row profile-contact"},o.createElement("div",{className:"media-list-header"},o.createElement("h2",null,"Contact")),o.createElement("form",{method:"post",className:"user-contact-form"+(this.state.isSending?" pending-response":"")},o.createElement("span",null,o.createElement("label",null,"Subject"),o.createElement("input",{ref:"msgSubject",type:"text",required:!0,onChange:this.onUpdateSubject,value:this.state.subject})),o.createElement("span",null,o.createElement("label",null,"Message"),o.createElement("textarea",{ref:"msgBody",required:!0,cols:"40",rows:"10",onChange:this.onUpdateBody,value:this