UNPKG

@r3l/app

Version:
2 lines 13.3 kB
(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[16],{"./src/modules/admin/admin.actions.js":function(e,t,n){"use strict";n.r(t),n.d(t,"setInvites",(function(){return y})),n.d(t,"destroyInvite",(function(){return w})),n.d(t,"setInviteCount",(function(){return j})),n.d(t,"getInviteCount",(function(){return g})),n.d(t,"getInvites",(function(){return O})),n.d(t,"createInvite",(function(){return L})),n.d(t,"destroy",(function(){return _})),n.d(t,"setDownvotes",(function(){return E})),n.d(t,"getDownvotes",(function(){return k})),n.d(t,"sendEmail",(function(){return x})),n.d(t,"saveEmail",(function(){return C})),n.d(t,"loadEmail",(function(){return P})),n.d(t,"sendPostNotification",(function(){return S}));var r=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),o=n.n(r),s=n("../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"),a=n.n(s),i=n("../../node_modules/@babel/runtime/regenerator/index.js"),u=n.n(i),c=n("../../node_modules/normalizr/dist/normalizr.es.js"),l=n("./src/core/actionTypes.js"),d=n("./src/utils/index.ts"),p=n("./src/utils/env.js"),h=n("./src/modules/auth/auth.actions.js");function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v=d.c.Alert(),b=new c.b.Entity("invites",{},{idAttribute:"_id"});function y(e){var t=e.data,n=e.community,r=e.skip;return{type:l.V,payload:{data:t,community:n,skip:r}}}function w(e){return{type:l.i,payload:e}}function j(e){return{type:l.X,payload:e}}function g(){return function(){var e=a()(u.a.mark((function e(t){var n;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(d.d.request({method:"GET",endpoint:"invites",path:"/count"}));case 3:n=e.sent,t(j(n)),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),v.alert(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()}function O(e,t,n){return function(){var r=a()(u.a.mark((function r(o){var s,a;return u.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,o(d.d.request({method:"GET",query:{skip:e,limit:t},endpoint:"invites",path:""}));case 3:return s=r.sent,a=Object(c.a)({invites:s},{invites:[b]}),o(y({data:a,community:n,skip:e})),r.abrupt("return",!0);case 9:return r.prev=9,r.t0=r.catch(0),r.abrupt("return",!1);case 12:case"end":return r.stop()}}),r,null,[[0,9]])})));return function(e){return r.apply(this,arguments)}}()}function L(e){return function(){var t=a()(u.a.mark((function t(n){var r;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n(d.d.request({method:"POST",endpoint:"invites",path:"/",body:JSON.stringify(e)}));case 3:return r=t.sent,n(Object(h.updateInvite)(r.invite[0])),n(j(r.count)),t.abrupt("return",r);case 9:return t.prev=9,t.t0=t.catch(0),v.alert(t.t0.message),t.abrupt("return",!1);case 13:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(e){return t.apply(this,arguments)}}()}function _(e){return function(){var t=a()(u.a.mark((function t(n){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=fetch,t.t1=p.a+"/api/invites/"+e._id,t.t2=m,t.t3={method:"DELETE"},t.next=6,d.d.reqOptions();case 6:return t.t4=t.sent,t.t5=(0,t.t2)(t.t3,t.t4),t.abrupt("return",(0,t.t0)(t.t1,t.t5).then(d.d.handleErrors).then((function(){v.alert("removed item"),n(w(e))})).catch((function(e){v.alert(e.message),console.log("invites error",e)})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}function E(e){return{type:l.Q,payload:e}}function k(e,t){return function(n){return n(d.d.request({method:"GET",query:{skip:e,limit:t},endpoint:"invest",path:"/downvotes"})).then((function(e){return n(E(e))})).catch((function(e){return v.alert(e.message)}))}}function x(e){return function(){var t=a()(u.a.mark((function t(n){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n(d.d.request({method:"PUT",endpoint:"email",path:"/",body:JSON.stringify(e)}));case 3:return v.alert("Email has been sent"),t.abrupt("return",!0);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()}function C(e){return function(){var t=a()(u.a.mark((function t(n){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n(d.d.request({method:"PUT",endpoint:"email",path:"/save",body:JSON.stringify(e)}));case 3:return v.alert("Email has been saved"),t.abrupt("return",!0);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()}function P(){return function(){var e=a()(u.a.mark((function e(t){var n;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t(d.d.request({method:"GET",endpoint:"email",path:"/load"}));case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()}function S(e){return function(){var t=a()(u.a.mark((function t(n){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n(d.d.request({method:"POST",endpoint:"post",path:"/sendPostNotification",body:JSON.stringify(e)}));case 3:return t.abrupt("return",v.alert("Notification sent!"));case 6:return t.prev=6,t.t0=t.catch(0),t.abrupt("return",!1);case 9:case"end":return t.stop()}}),t,null,[[0,6]])})));return function(e){return t.apply(this,arguments)}}()}},"./src/modules/admin/web/downvotes.container.js":function(e,t,n){"use strict";n.r(t);var r=n("../../node_modules/@babel/runtime/helpers/classCallCheck.js"),o=n.n(r),s=n("../../node_modules/@babel/runtime/helpers/createClass.js"),a=n.n(s),i=n("../../node_modules/@babel/runtime/helpers/assertThisInitialized.js"),u=n.n(i),c=n("../../node_modules/@babel/runtime/helpers/inherits.js"),l=n.n(c),d=n("../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"),p=n.n(d),h=n("../../node_modules/@babel/runtime/helpers/getPrototypeOf.js"),f=n.n(h),m=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),v=n.n(m),b=n("../../node_modules/react/index.js"),y=n.n(b),w=n("../../node_modules/prop-types/index.js"),j=n.n(w),g=n("../../node_modules/redux/es/redux.js"),O=n("../../node_modules/react-redux/es/index.js"),L=n("./src/modules/admin/admin.actions.js"),_=n("./src/modules/listview/web/infScroll.component.js"),E=n("./src/utils/numbers.js");function k(e){var t=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(e){return!1}}();return function(){var n,r=f()(e);if(t){var o=f()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p()(this,n)}}var x=function(e){l()(n,e);var t=k(n);function n(e){var r;return o()(this,n),(r=t.call(this,e)).renderDownvote=r.renderDownvote.bind(u()(r)),r.load=r.load.bind(u()(r)),r.hasMore=!0,r}return a()(n,[{key:"renderDownvote",value:function(e){return y.a.createElement("div",{className:"downvoteList",key:e._id},y.a.createElement("div",{className:"dUser"},e.investor),y.a.createElement("div",null,"- ",e.author),y.a.createElement("div",null,Object(E.getDayMonthYearTimestamp)(e.createdAt)),y.a.createElement("div",null,e.post?Object(E.getDayMonthYearTimestamp)(e.post.createdAt):"[deleted]"))}},{key:"load",value:function(e){var t=this.props.admin.downvotes.length;this.hasMore=40*(e-1)<=t,this.hasMore&&this.props.actions.getDownvotes(t,40)}},{key:"render",value:function(){var e=this,t=this.props.admin.downvotes.map((function(t){return e.renderDownvote(t)}));return y.a.createElement("div",null,y.a.createElement("h2",null,"Downvotes"),y.a.createElement(_.a,{data:this.props.admin.downvotes,className:"adminContainer",loadMore:this.load,hasMore:this.hasMore},t))}}]),n}(b.Component);v()(x,"propTypes",{admin:j.a.object,actions:j.a.object}),t.default=Object(O.b)((function(e){return{auth:e.auth,admin:e.admin}}),(function(e){return{actions:Object(g.b)(L,e)}}))(x)},"./src/modules/listview/web/infScroll.component.js":function(e,t,n){"use strict";n.d(t,"a",(function(){return E}));var r=n("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),o=n.n(r),s=n("../../node_modules/@babel/runtime/helpers/classCallCheck.js"),a=n.n(s),i=n("../../node_modules/@babel/runtime/helpers/createClass.js"),u=n.n(i),c=n("../../node_modules/@babel/runtime/helpers/assertThisInitialized.js"),l=n.n(c),d=n("../../node_modules/@babel/runtime/helpers/inherits.js"),p=n.n(d),h=n("../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"),f=n.n(h),m=n("../../node_modules/@babel/runtime/helpers/getPrototypeOf.js"),v=n.n(m),b=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),y=n.n(b),w=n("../../node_modules/react/index.js"),j=n.n(w),g=n("../../node_modules/prop-types/index.js"),O=n.n(g),L=["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","threshold","useCapture","useWindow","data"];function _(e){var t=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(e){return!1}}();return function(){var n,r=v()(e);if(t){var o=v()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f()(this,n)}}var E=function(e){p()(n,e);var t=_(n);function n(e){var r;return a()(this,n),(r=t.call(this,e)).scrollListener=r.scrollListener.bind(l()(r)),r.attachScrollListener=r.attachScrollListener.bind(l()(r)),r}return u()(n,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.attachScrollListener(),this.data=this.props.data,this.data&&this.data.length||this.props.loadMore(this.pageLoaded)}},{key:"componentDidUpdate",value:function(){this.data.length!==this.props.data.length&&(this.attachScrollListener(),this.data=this.props.data),!this.props.data.length<this.data.length&&(this.pageLoaded=this.props.pageStart)}},{key:"componentWillUnmount",value:function(){this.detachScrollListener()}},{key:"setDefaultLoader",value:function(e){this.defaultLoader=e}},{key:"detachScrollListener",value:function(){var e=window;!1===this.props.useWindow&&(e=this.scrollComponent.parentNode),e.removeEventListener("scroll",this.scrollListener,this.props.useCapture),e.removeEventListener("resize",this.scrollListener,this.props.useCapture)}},{key:"attachScrollListener",value:function(){if(this.props.hasMore){var e=window;!1===this.props.useWindow&&(e=this.scrollComponent.parentNode),e.addEventListener("scroll",this.scrollListener,this.props.useCapture),e.addEventListener("resize",this.scrollListener,this.props.useCapture),this.props.initialLoad&&this.scrollListener()}}},{key:"scrollListener",value:function(){if(this.props.data&&this.props.data.length){var e,t=this.scrollComponent,n=window;if(this.props.useWindow){var r=void 0!==n.pageYOffset?n.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;e=this.props.isReverse?r:this.calculateTopPosition(t)+(t.offsetHeight-r-window.innerHeight)}else e=this.props.isReverse?t.parentNode.scrollTop:t.scrollHeight-t.parentNode.scrollTop-t.parentNode.clientHeight;e<Number(this.props.threshold)&&(this.detachScrollListener(),"function"==typeof this.props.loadMore&&this.props.loadMore(this.pageLoaded+=1))}}},{key:"calculateTopPosition",value:function(e){return e?e.offsetTop+this.calculateTopPosition(e.offsetParent):0}},{key:"render",value:function(){var e=this,t=this.props,n=t.children,r=t.element,s=t.hasMore,a=(t.initialLoad,t.isReverse,t.loader),i=(t.loadMore,t.pageStart,t.threshold,t.useCapture,t.useWindow,t.data,o()(t,L));return i.ref=function(t){e.scrollComponent=t},j.a.createElement(r,i,n,s&&(a||this.defaultLoader))}}]),n}(w.Component);y()(E,"propTypes",{data:O.a.array}),E.propTypes={element:O.a.string,hasMore:O.a.bool,initialLoad:O.a.bool,isReverse:O.a.bool,loadMore:O.a.func.isRequired,pageStart:O.a.number,threshold:O.a.number,useCapture:O.a.bool,useWindow:O.a.bool,children:O.a.oneOfType([O.a.object,O.a.array]).isRequired,loader:O.a.object},E.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null}}}]); //# sourceMappingURL=admin-web-downvotes-container.bundle.6d43cfec7c11d915b173.js.map