mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-06 07:28:53 -05:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
!function(){"use strict";var t,e={463:function(t,e,n){n.d(e,{c:function(){return r}});var i=n(4571),o=n.n(i);function r(t,e){let n=o()(t,{});return""!==n.origin&&"null"!==n.origin&&n.origin||(n=o()(e+"/"+t.replace(/^\//g,""),{})),n.toString()}},1838:function(t,e,n){n.r(e),n.d(e,{BrowserEvents:function(){return i.GT},PositiveInteger:function(){return h.e},PositiveIntegerOrZero:function(){return h.R},addClassname:function(){return i.zc},cancelAnimationFrame:function(){return i.uU},csrfToken:function(){return l.G},deleteRequest:function(){return g.Fb},error:function(){return d.z},exportStore:function(){return r.A},formatInnerLink:function(){return a.c},formatManagementTableDate:function(){return s.n},formatViewsNumber:function(){return u.A},getRequest:function(){return g.iq},greaterCommonDivision:function(){return m.p7},hasClassname:function(){return i.CX},imageExtension:function(){return c.t},isGt:function(){return m.en},isInteger:function(){return m.Fq},isNumber:function(){return m.Et},isPositive:function(){return m.ep},isPositiveInteger:function(){return m.q6},isPositiveIntegerOrZero:function(){return m.tR},isPositiveNumber:function(){return m.F5},isZero:function(){return m.be},logErrorAndReturnError:function(){return o.m},logWarningAndReturnError:function(){return o.g},postRequest:function(){return g.MB},publishedOnDate:function(){return f.A},putRequest:function(){return g.zi},quickSort:function(){return p.g},removeClassname:function(){return i.qk},replaceString:function(){return v.u},requestAnimationFrame:function(){return i.xi},supportsSvgAsImg:function(){return i.kN},translateString:function(){return b.g},warn:function(){return d.R}});var i=n(1134),o=n(6403),r=n(977),a=n(463),s=n(8482),u=n(4632),l=n(5393),c=n(1554),d=n(8004),m=n(8354),h=n(1702),f=n(7673),p=n(1453),g=n(9659),b=n(4036),v=n(4470)},3155:function(t,e,n){var i=n(2985),o=n(9471),r=n(8713),a=n.n(r),s=n(4571),u=n.n(s),l=n(8790),c=n(1838),d=n(285),m=n(7460),h=n(1177),f=n(239),p=n(6190),g=n(7545),b=n(8974);class v extends o.PureComponent{constructor(t){super(t),this.state={subject:"",body:"",isSending:!1},this.onUpdateSubject=this.onUpdateSubject.bind(this),this.onUpdateBody=this.onUpdateBody.bind(this),this.onSubmit=this.onSubmit.bind(this),this.onSubmitSuccess=this.onSubmitSuccess.bind(this),this.onSubmitFail=this.onSubmitFail.bind(this)}onUpdateSubject(){this.setState({subject:this.refs.msgSubject.value.trim()})}onUpdateBody(){this.setState({body:this.refs.msgBody.value.trim()})}onSubmitSuccess(t){this.setState({subject:"",body:"",isSending:!1},(function(){setTimeout(function(){d.PageActions.addNotification("Your message was successfully submitted to "+this.props.author.name,"messageSubmitSucceed")}.bind(this),100)}))}onSubmitFail(t){this.setState({isSending:!1},(function(){b.log(t),setTimeout(function(){d.PageActions.addNotification("Your message failed to submit. Please try again","messageSubmitFailed")}.bind(this),100)}))}onSubmit(t){this.state.isSending||""===this.state.subject||""===this.state.body||(t.preventDefault(),t.stopPropagation(),this.setState({isSending:!0},(function(){const t=l.ApiUrlContext._currentValue.users+"/"+this.props.author.username+"/contact";(0,c.postRequest)(t,{subject:this.state.subject,body:this.state.body},{headers:{"X-CSRFToken":(0,c.csrfToken)()}},!1,this.onSubmitSuccess,this.onSubmitFail)})))}render(){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.state.body})),o.createElement("button",{onClick:this.onSubmit},"SUBMIT")))}}class y extends g.R{constructor(t){super(t,"author-about"),this.userIsAuthor=null,this.enabledContactForm=!1}pageContent(){let t=null,e=[],n=[];if(this.state.author){let i,r;if(null===this.userIsAuthor&&(l.MemberContext._currentValue.is.anonymous?(this.userIsAuthor=!1,this.enabledContactForm=!1):(this.userIsAuthor=m.ProfilePageStore.get("author-data").username===l.MemberContext._currentValue.username,this.enabledContactForm=!this.userIsAuthor&&l.MemberContext._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){let t=[];for(i=0;i<this.state.author.location_info.length;)void 0!==this.state.author.location_info[i].title&&void 0!==this.state.author.location_info[i].url&&t.push(o.createElement("a",{key:i,href:(0,c.formatInnerLink)(this.state.author.location_info[i].url,l.SiteContext._currentValue.url),title:this.state.author.location_info[i].title},this.state.author.location_info[i].title)),i+=1;e.push(o.createElement("li",{key:"location"},o.createElement("span",null,"Location:"),o.createElement("span",null,t)))}else void 0!==this.state.author.location&&this.state.author.location&&""!==this.state.author.location&&e.push(o.createElement("li",{key:"location"},o.createElement("span",null,"Location:"),o.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&&(r=u()(this.state.author.home_page.trim()).toString(),""!==r&&e.push(o.createElement("li",{key:"website"},o.createElement("span",null,"Website:"),o.createElement("span",null,r)))),void 0!==this.state.author.social_media_links&&this.state.author.social_media_links&&""!==this.state.author.social_media_links){let t=this.state.author.social_media_links.split(",");if(t.length){for(i=0;i<t.length;)r=t[i].trim(),""!==r&&n.push(o.createElement("span",{key:i},r)),i+=1;e.push(o.createElement("li",{key:"social_media"},o.createElement("span",null,"Social media:"),o.createElement("span",{className:"author-social-media"},n)))}}}return[this.state.author?o.createElement(h.A,{key:"ProfilePagesHeader",author:this.state.author,type:"about"}):null,this.state.author?o.createElement(f.A,{key:"ProfilePagesContent",enabledContactForm:this.enabledContactForm},o.createElement("div",{className:"media-list-wrapper items-list-ver profile-about-content "},null===t&&0<e.length?null:m.PageStore.get("config-options").pages.profile.htmlInDescription?o.createElement(p.MediaListRow,{title:this.props.title},o.createElement("span",{dangerouslySetInnerHTML:{__html:t||null}})):o.createElement(p.MediaListRow,{title:this.props.title},t),e.length?o.createElement(p.MediaListRow,{title:"Details"},o.createElement("ul",{className:"profile-details"},e)):null,this.enabledContactForm?o.createElement(v,{author:this.state.author}):null)):null]}}y.propTypes={title:a().string.isRequired},y.defaultProps={title:"Biography"},(0,i.C)("page-profile-about",y)},6089:function(t,e,n){n.d(e,{$:function(){return s}});var i=n(9471),o=n(6371);let r=[];function a(t){const[e,n]=(0,i.useState)(!1),[o,r]=(0,i.useState)(!0);let a=null,s=null;return(0,i.useEffect)((()=>(a=setTimeout((function(){s=setTimeout((function(){r(!1),s=null}),1e3),a=null,n(!0),t.onHide(t.id)}),5e3),()=>{a&&clearTimeout(a),s&&clearTimeout(s)})),[]),o?i.createElement("div",{className:"notification-item"+(e?" hidden":"")},i.createElement("div",null,i.createElement("span",null,t.children||"No message"))):null}function s(){const[t,e]=(0,i.useState)(r.length);function n(){e(o.default.get("notifications-size")+r.length)}function s(t){const e=[];r.map((n=>{n[0]!==t&&e.push(n)})),r=e}return(0,i.useEffect)((()=>(n(),o.default.on("added_notification",n),()=>o.default.removeListener("added_notification",n))),[]),t?i.createElement("div",{className:"notifications"},i.createElement("div",null,function(){const t=o.default.get("notifications");return[...r.map((t=>i.createElement(a,{key:t[0],id:t[0],onHide:s},t[1]))),...t.map((t=>(r.push(t),i.createElement(a,{key:t[0],id:t[0],onHide:s},t[1]))))]}())," "):null}},6371:function(t,e,n){n.r(e);var i=n(9032),o=n.n(i),r=n(7154),a=n(1838),s=n(3997);function u(){let t=new Uint32Array(3);return window.crypto.getRandomValues(t),(performance.now().toString(36)+Array.from(t).map((t=>t.toString(36))).join("")).replace(/./g,""+Math.random()+Intl.DateTimeFormat().resolvedOptions().timeZone+Date.now())}let l,c=null,d=null;class m extends(o()){constructor(t){super(),d=(0,s.$)(window.MediaCMS),l=new r.BrowserCache(d.site.id,86400),c={mediaAutoPlay:l.get("media-auto-play")},c.mediaAutoPlay=null===c.mediaAutoPlay||c.mediaAutoPlay,this.browserEvents=(0,a.BrowserEvents)(),this.browserEvents.doc(this.onDocumentVisibilityChange.bind(this)),this.browserEvents.win(this.onWindowResize.bind(this),this.onWindowScroll.bind(this)),this.notifications=function(t){let e=[];function n(t){"string"==typeof t&&e.push([u(),t])}return t.map(n),{size:function(){return e.length},push:n,clear:function(){e=[]},messages:function(){return[...e]}}}(void 0!==window.MediaCMS&&void 0!==window.MediaCMS.notifications?window.MediaCMS.notifications:[])}onDocumentVisibilityChange(){this.emit("document_visibility_change")}onWindowScroll(){this.emit("window_scroll")}onWindowResize(){this.emit("window_resize")}initPage(t){c.currentPage=t}get(t){let e;switch(t){case"browser-cache":e=l;break;case"media-auto-play":e=c.mediaAutoPlay;break;case"config-contents":e=d.contents;break;case"config-enabled":e=d.enabled;break;case"config-media-item":e=d.media.item;break;case"config-options":e=d.options;break;case"config-site":e=d.site;break;case"api-playlists":n=t.split("-")[1],e=d.api[n]||null;break;case"notifications-size":e=this.notifications.size();break;case"notifications":e=this.notifications.messages(),this.notifications.clear();break;case"current-page":e=c.currentPage}var n;return e}actions_handler(t){switch(t.type){case"INIT_PAGE":this.initPage(t.page),this.emit("page_init");break;case"TOGGLE_AUTO_PLAY":c.mediaAutoPlay=!c.mediaAutoPlay,l.set("media-auto-play",c.mediaAutoPlay),this.emit("switched_media_auto_play");break;case"ADD_NOTIFICATION":this.notifications.push(t.notification),this.emit("added_notification")}}}e.default=(0,a.exportStore)(new m,"actions_handler")},6568:function(t,e,n){n.d(e,{x:function(){return a}});var i=n(9471),o=n(8713),r=n.n(o);function a(t){let e="spinner-loader";switch(t.size){case"tiny":case"x-small":case"small":case"large":case"x-large":e+=" "+t.size}return i.createElement("div",{className:e},i.createElement("svg",{className:"circular",viewBox:"25 25 50 50"},i.createElement("circle",{className:"path",cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:"1.5",strokeMiterlimit:"10"})))}a.propTypes={size:r().oneOf(["tiny","x-small","small","medium","large","x-large"])},a.defaultProps={size:"medium"}},7256:function(t,e,n){n.d(e,{P:function(){return s}});var i=n(9471),o=n(8713),r=n.n(o),a=n(2828);function s(t){return t.options.map((e=>i.createElement("div",{key:e.id,className:e.id===t.selected?"active":""},i.createElement("button",{onClick:t.onSelect,filter:t.id,value:e.id},i.createElement("span",null,e.title),e.id===t.selected?i.createElement(a.Z,{type:"close"}):null))))}s.propTypes={id:r().string.isRequired,selected:r().string.isRequired,onSelect:r().func.isRequired}}},n={};function i(t){var o=n[t];if(void 0!==o)return o.exports;var r=n[t]={exports:{}};return e[t].call(r.exports,r,r.exports,i),r.exports}i.m=e,t=[],i.O=function(e,n,o,r){if(!n){var a=1/0;for(c=0;c<t.length;c++){n=t[c][0],o=t[c][1],r=t[c][2];for(var s=!0,u=0;u<n.length;u++)(!1&r||a>=r)&&Object.keys(i.O).every((function(t){return i.O[t](n[u])}))?n.splice(u--,1):(s=!1,r<a&&(a=r));if(s){t.splice(c--,1);var l=o();void 0!==l&&(e=l)}}return e}r=r||0;for(var c=t.length;c>0&&t[c-1][2]>r;c--)t[c]=t[c-1];t[c]=[n,o,r]},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.j=382,function(){var t={382:0};i.O.j=function(e){return 0===t[e]};var e=function(e,n){var o,r,a=n[0],s=n[1],u=n[2],l=0;if(a.some((function(e){return 0!==t[e]}))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(u)var c=u(i)}for(e&&e(n);l<a.length;l++)r=a[l],i.o(t,r)&&t[r]&&t[r][0](),t[r]=0;return i.O(c)},n=self.webpackChunkmediacms_frontend=self.webpackChunkmediacms_frontend||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))}();var o=i.O(void 0,[276],(function(){return i(3155)}));o=i.O(o)}(); |