UNPKG

@r3l/app

Version:
2 lines 16.5 kB
(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[34],{"../../node_modules/redux-form/es/Field.js":function(e,r,n){"use strict";var t=n("../../node_modules/@babel/runtime/helpers/extends.js"),a=n.n(t),o=n("../../node_modules/@babel/runtime/helpers/createClass.js"),s=n.n(o),i=n("../../node_modules/@babel/runtime/helpers/inheritsLoose.js"),u=n.n(i),c=n("../../node_modules/react/index.js"),l=n.n(c),d=n("../../node_modules/prop-types/index.js"),p=n.n(d),f=n("../../node_modules/invariant/browser.js"),m=n.n(f),h=n("../../node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js"),v=n.n(h),b=n("../../node_modules/react-redux/es/index.js"),y=function(e,r,n,t){var o=r.value;return"checkbox"===e?a()({},r,{checked:!!o}):"radio"===e?a()({},r,{checked:t(o,n),value:n}):"select-multiple"===e?a()({},r,{value:o||[]}):"file"===e?a()({},r,{value:o||void 0}):r};var g=n("../../node_modules/redux-form/es/events/isEvent.js"),x=function(e,r){if(Object(g.a)(e)){if(!r&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(r&&void 0!==e.nativeEvent)return e.nativeEvent.text;var n=e,t=n.target,a=t.type,o=t.value,s=t.checked,i=t.files,u=n.dataTransfer;return"checkbox"===a?!!s:"file"===a?i||u&&u.files:"select-multiple"===a?function(e){var r=[];if(e)for(var n=0;n<e.length;n++){var t=e[n];t.selected&&r.push(t.value)}return r}(e.target.options):o}return e},j="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,w=function(e,r){var n=r.name,t=r.parse,a=r.normalize,o=x(e,j);return t&&(o=t(o,n)),a&&(o=a(n,o)),o},_=n("../../node_modules/redux-form/es/structure/plain/index.js"),E=n("../../node_modules/react-is/index.js"),F=function(e,r,n){return Object(E.isValidElementType)(e[r])?null:new Error("Invalid prop `"+r+"` supplied to `"+n+"`.")},D=["_reduxForm"],k=function(e){return e&&"object"==typeof e},C=function(e){return e&&"function"==typeof e},O=function(e){k(e)&&C(e.preventDefault)&&e.preventDefault()},P=function(e,r){if(k(e)&&k(e.dataTransfer)&&C(e.dataTransfer.getData))return e.dataTransfer.getData(r)},R=function(e,r,n){k(e)&&k(e.dataTransfer)&&C(e.dataTransfer.setData)&&e.dataTransfer.setData(r,n)};var T=function(e){var r=e.deepEqual,n=e.getIn,t=function(n){function t(){for(var e,r=arguments.length,t=new Array(r),o=0;o<r;o++)t[o]=arguments[o];return(e=n.call.apply(n,[this].concat(t))||this).ref=l.a.createRef(),e.isPristine=function(){return e.props.pristine},e.getValue=function(){return e.props.value},e.handleChange=function(r){var n=e.props,t=n.name,o=n.dispatch,s=n.parse,i=n.normalize,u=n.onChange,c=n._reduxForm,l=n.value,d=w(r,{name:t,parse:s,normalize:i}),p=!1;if(u)if(!j&&Object(g.a)(r))u(a()({},r,{preventDefault:function(){return p=!0,O(r)}}),d,l,t);else{var f=u(r,d,l,t);j&&(p=f)}p||(o(c.change(t,d)),c.asyncValidate&&c.asyncValidate(t,d,"change"))},e.handleFocus=function(r){var n=e.props,t=n.name,o=n.dispatch,s=n.onFocus,i=n._reduxForm,u=!1;s&&(j?u=s(r,t):s(a()({},r,{preventDefault:function(){return u=!0,O(r)}}),t)),u||o(i.focus(t))},e.handleBlur=function(r){var n=e.props,t=n.name,o=n.dispatch,s=n.parse,i=n.normalize,u=n.onBlur,c=n._reduxForm,l=n._value,d=n.value,p=w(r,{name:t,parse:s,normalize:i});p===l&&void 0!==l&&(p=d);var f=!1;u&&(j?f=u(r,p,d,t):u(a()({},r,{preventDefault:function(){return f=!0,O(r)}}),p,d,t)),f||(o(c.blur(t,p)),c.asyncValidate&&c.asyncValidate(t,p,"blur"))},e.handleDragStart=function(r){var n=e.props,t=n.name,a=n.onDragStart,o=n.value;R(r,"text",null==o?"":o),a&&a(r,t)},e.handleDrop=function(r){var n=e.props,t=n.name,o=n.dispatch,s=n.onDrop,i=n._reduxForm,u=n.value,c=P(r,"text"),l=!1;s&&s(a()({},r,{preventDefault:function(){return l=!0,O(r)}}),c,u,t),l||(o(i.change(t,c)),O(r))},e}u()(t,n);var o=t.prototype;return o.shouldComponentUpdate=function(e){var n=this,t=Object.keys(e),a=Object.keys(this.props);return!!(this.props.children||e.children||t.length!==a.length||t.some((function(t){return~(e.immutableProps||[]).indexOf(t)?n.props[t]!==e[t]:!~D.indexOf(t)&&!r(n.props[t],e[t])})))},o.getRenderedComponent=function(){return this.ref.current},o.render=function(){var r=this.props,n=r.component,t=r.forwardRef,o=r.name,s=r._reduxForm,i=(r.normalize,r.onBlur,r.onChange,r.onFocus,r.onDragStart,r.onDrop,r.immutableProps,v()(r,["component","forwardRef","name","_reduxForm","normalize","onBlur","onChange","onFocus","onDragStart","onDrop","immutableProps"])),u=function(e,r,n){var t=e.getIn,o=e.toJS,s=e.deepEqual,i=n.asyncError,u=n.asyncValidating,c=n.onBlur,l=n.onChange,d=n.onDrop,p=n.onDragStart,f=n.dirty,m=n.dispatch,h=n.onFocus,b=n.form,g=n.format,x=n.initial,j=(n.parse,n.pristine),w=n.props,_=n.state,E=n.submitError,F=n.submitFailed,D=n.submitting,k=n.syncError,C=n.syncWarning,O=(n.validate,n.value),P=n._value,R=(n.warn,v()(n,["asyncError","asyncValidating","onBlur","onChange","onDrop","onDragStart","dirty","dispatch","onFocus","form","format","initial","parse","pristine","props","state","submitError","submitFailed","submitting","syncError","syncWarning","validate","value","_value","warn"])),T=k||i||E,S=C,A=function(e,n){if(null===n)return e;var t=null==e?"":e;return n?n(e,r):t}(O,g);return{input:y(R.type,{name:r,onBlur:c,onChange:l,onDragStart:p,onDrop:d,onFocus:h,value:A},P,s),meta:a()({},o(_),{active:!(!_||!t(_,"active")),asyncValidating:u,autofilled:!(!_||!t(_,"autofilled")),dirty:f,dispatch:m,error:T,form:b,initial:x,warning:S,invalid:!!T,pristine:j,submitting:!!D,submitFailed:!!F,touched:!(!_||!t(_,"touched")),valid:!T,visited:!(!_||!t(_,"visited"))}),custom:a()({},R,{},w)}}(e,o,a()({},i,{form:s.form,onBlur:this.handleBlur,onChange:this.handleChange,onDrop:this.handleDrop,onDragStart:this.handleDragStart,onFocus:this.handleFocus})),l=u.custom,d=v()(u,["custom"]);if(t&&(l.ref=this.ref),"string"==typeof n){var p=d.input;d.meta;return Object(c.createElement)(n,a()({},p,{},l))}return Object(c.createElement)(n,a()({},d,{},l))},t}(c.Component);return t.propTypes={component:F,props:p.a.object},Object(b.b)((function(e,t){var a=t.name,o=t._reduxForm,s=o.initialValues,i=(0,o.getFormState)(e),u=n(i,"initial."+a),c=void 0!==u?u:s&&n(s,a),l=n(i,"values."+a),d=n(i,"submitting"),p=function(e,r){var n=_.a.getIn(e,r);return n&&n._error?n._error:n}(n(i,"syncErrors"),a),f=function(e,r){var t=n(e,r);return t&&t._warning?t._warning:t}(n(i,"syncWarnings"),a),m=r(l,c);return{asyncError:n(i,"asyncErrors."+a),asyncValidating:n(i,"asyncValidating")===a,dirty:!m,pristine:m,state:n(i,"fields."+a),submitError:n(i,"submitErrors."+a),submitFailed:n(i,"submitFailed"),submitting:d,syncError:p,syncWarning:f,initial:c,value:l,_value:t.value}}),void 0,void 0,{forwardRef:!0})(t)},S=n("../../node_modules/lodash/isEqualWith.js"),A=n.n(S),B=function(e,r,n,t,a,o){if(o)return e===r},V=function(e,r,n){var t=A()(e.props,r,B),a=A()(e.state,n,B);return!t||!a},z=function(e,r){var n=e._reduxForm.sectionPrefix;return n?n+"."+r:r},U=n("../../node_modules/redux-form/es/ReduxFormContext.js");var M=function(e){var r=T(e),n=e.setIn,t=function(e){function t(r){var t;if((t=e.call(this,r)||this).ref=l.a.createRef(),t.normalize=function(e,r){var a=t.props.normalize;if(!a)return r;var o=t.props._reduxForm.getValues();return a(r,t.value,n(o,e,r),o,e)},!r._reduxForm)throw new Error("Field must be inside a component decorated with reduxForm()");return t}u()(t,e);var o=t.prototype;return o.componentDidMount=function(){var e=this;this.props._reduxForm.register(this.name,"Field",(function(){return e.props.validate}),(function(){return e.props.warn}))},o.shouldComponentUpdate=function(e,r){return V(this,e,r)},o.UNSAFE_componentWillReceiveProps=function(e){var r=z(this.props,this.props.name),n=z(e,e.name);r===n&&_.a.deepEqual(this.props.validate,e.validate)&&_.a.deepEqual(this.props.warn,e.warn)||(this.props._reduxForm.unregister(r),this.props._reduxForm.register(n,"Field",(function(){return e.validate}),(function(){return e.warn})))},o.componentWillUnmount=function(){this.props._reduxForm.unregister(this.name)},o.getRenderedComponent=function(){return m()(this.props.forwardRef,"If you want to access getRenderedComponent(), you must specify a forwardRef prop to Field"),this.ref.current?this.ref.current.getRenderedComponent():void 0},o.render=function(){return Object(c.createElement)(r,a()({},this.props,{name:this.name,normalize:this.normalize,ref:this.ref}))},s()(t,[{key:"name",get:function(){return z(this.props,this.props.name)}},{key:"dirty",get:function(){return!this.pristine}},{key:"pristine",get:function(){return!(!this.ref.current||!this.ref.current.isPristine())}},{key:"value",get:function(){return this.ref.current&&this.ref.current.getValue()}}]),t}(c.Component);return t.propTypes={name:p.a.string.isRequired,component:F,format:p.a.func,normalize:p.a.func,onBlur:p.a.func,onChange:p.a.func,onFocus:p.a.func,onDragStart:p.a.func,onDrop:p.a.func,parse:p.a.func,props:p.a.object,validate:p.a.oneOfType([p.a.func,p.a.arrayOf(p.a.func)]),warn:p.a.oneOfType([p.a.func,p.a.arrayOf(p.a.func)]),forwardRef:p.a.bool,immutableProps:p.a.arrayOf(p.a.string),_reduxForm:p.a.object},Object(U.b)(t)};r.a=M(_.a)},"./src/modules/auth/web/resetPassword.component.js":function(e,r,n){"use strict";n.r(r);var t=n("../../node_modules/@babel/runtime/helpers/extends.js"),a=n.n(t),o=n("../../node_modules/@babel/runtime/helpers/classCallCheck.js"),s=n.n(o),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),f=n("../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"),m=n.n(f),h=n("../../node_modules/@babel/runtime/helpers/getPrototypeOf.js"),v=n.n(h),b=n("../../node_modules/@babel/runtime/helpers/defineProperty.js"),y=n.n(b),g=n("../../node_modules/react/index.js"),x=n.n(g),j=n("../../node_modules/prop-types/index.js"),w=n.n(j),_=n("../../node_modules/react-router/esm/react-router.js"),E=n("./src/modules/styled/form/reduxformfield.component.js"),F=n("../../node_modules/redux-form/es/Field.js"),D=n("../../node_modules/redux-form/es/reduxForm.js"),k=n("./src/modules/styled/web.tsx"),C=n("./src/modules/form/validators.js"),O=n("../../node_modules/redux/es/redux.js"),P=n("../../node_modules/react-redux/es/index.js"),R=n("./src/modules/auth/auth.actions.js"),T=n("./src/modules/navigation/navigation.actions.js");function S(e){var r=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,t=v()(e);if(r){var a=v()(this).constructor;n=Reflect.construct(t,arguments,a)}else n=t.apply(this,arguments);return m()(this,n)}}var A=function(e){p()(n,e);var r=S(n);function n(e){var t;return s()(this,n),t=r.call(this,e),y()(l()(t),"submit",(function(e){var r=t.props.auth.user;t.props.actions.resetPassword(e.password,t.token).then((function(e){e&&!r?t.props.actions.showModal("login"):t.props.close()}))})),t.submit=t.submit.bind(l()(t)),t}return u()(n,[{key:"UNSAFE_componentWillMount",value:function(){var e=this.props.location,r=Object(_.f)(e.pathname,{path:"/user/resetPassword/:token",exact:!0});this.token=r&&r.params&&r.params.token}},{key:"render",value:function(){var e=this.props.handleSubmit,r=[{name:"password",component:E.a,type:"password",label:"Password",validate:[C.f]},{name:"confirmPassword",component:E.a,type:"password",label:"Confirm Password",validate:[C.f]}];return x.a.createElement(k.j,{sx:{my:4}},x.a.createElement(k.c,{sx:{flex:1},onSubmit:e(this.submit.bind(this))},r.map((function(e,r){return x.a.createElement(F.a,a()({},e,{key:r}))})),x.a.createElement(k.j,{sx:{mt:4,justifyContent:"flex-end"}},x.a.createElement(k.a,{type:"submit",sx:{p:0}},"Update Password"))))}}]),n}(g.Component);y()(A,"propTypes",{match:w.a.object,actions:w.a.object,history:w.a.object,handleSubmit:w.a.func,auth:w.a.object,close:w.a.func,showModal:w.a.func,location:w.a.object});r.default=Object(D.a)({form:"settings",validate:function(e){var r={};if(e.password!==e.confirmPassword){var n="Passwords must be identical";r.password=n,r.confirmPassword=n}return r}})(Object(P.b)((function(e){return{user:e.auth.user,auth:e.auth}}),(function(e){return{actions:Object(O.b)({resetPassword:R.resetPassword,hideModal:T.hideModal,showModal:T.showModal},e)}}))(Object(_.h)(A)))},"./src/modules/form/validators.js":function(e,r,n){"use strict";n.d(r,"f",(function(){return c})),n.d(r,"d",(function(){return l})),n.d(r,"h",(function(){return d})),n.d(r,"a",(function(){return p})),n.d(r,"b",(function(){return f})),n.d(r,"g",(function(){return m})),n.d(r,"e",(function(){return h})),n.d(r,"c",(function(){return v}));var t=n("../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"),a=n.n(t),o=n("../../node_modules/@babel/runtime/regenerator/index.js"),s=n.n(o),i=n("./src/utils/text.js"),u=n("./src/modules/auth/auth.actions.js"),c=function(e,r,n){return null!=e?void 0:"Required"},l=function(e,r,n){if(!n.active&&(e&&!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,15}$/i.test(e)))return"Not a valid e-mail"},d=function(e){if(!i.NAME_PATTERN.test(e))return"Can only contain letters, \nnumbers, dashes and underscores"},p=function(){var e=a()(s.a.mark((function e(r,n,t){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.active){e.next=2;break}return e.abrupt("return",void 0);case 2:return e.next=4,Object(u.checkUser)(r,"email",!0)();case 4:if(!e.sent){e.next=7;break}return e.abrupt("return","This email has already been used");case 7:return e.abrupt("return",void 0);case 8:case"end":return e.stop()}}),e)})));return function(r,n,t){return e.apply(this,arguments)}}(),f=function(){var e=a()(s.a.mark((function e(r,n,t){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.active){e.next=2;break}return e.abrupt("return",void 0);case 2:if(!r){e.next=8;break}return e.next=5,Object(u.checkUser)(r,"name",!0)();case 5:if(!e.sent){e.next=8;break}return e.abrupt("return","This username is already taken");case 8:return e.abrupt("return",void 0);case 9:case"end":return e.stop()}}),e)})));return function(r,n,t){return e.apply(this,arguments)}}(),m=function(){var e=a()(s.a.mark((function e(r,n,t){var a,o,i,u;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a={},!r.username){e.next=6;break}return e.next=4,f(r.username);case 4:(o=e.sent)&&(a.username=o);case 6:if(!r.email){e.next=11;break}return e.next=9,p(r.email);case 9:(i=e.sent)&&(a.email=i);case 11:if(!r.handle){e.next=16;break}return e.next=14,f(r.handle);case 14:(u=e.sent)&&(a.handle=u);case 16:if(!Object.keys(a).length){e.next=18;break}throw a;case 18:case"end":return e.stop()}}),e)})));return function(r,n,t){return e.apply(this,arguments)}}(),h=function(e){var r={};return e.password&&e.confirmPassword?(e.password!==e.confirmPassword&&(r.confirmPassword="Passwords must match"),r):null},v=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return r.reduce((function(e,r){return e||r.apply(void 0,n)}),void 0)}}},"./src/modules/styled/form/reduxformfield.component.js":function(e,r,n){"use strict";var t=n("../../node_modules/@babel/runtime/helpers/extends.js"),a=n.n(t),o=n("../../node_modules/react/index.js"),s=n.n(o),i=n("../../node_modules/prop-types/index.js"),u=n.n(i),c=n("./src/modules/styled/web.tsx"),l=n("./src/modules/styled/index.ts");function d(e){var r=e.label,n=e.type,t=e.input,o=e.meta,i=e.placeholder,u=e.autocomplete,d=e.form,p=o.dirty,f=o.touched,m=o.error,h=o.warning;return s.a.createElement(l.K,{sx:{mt:3}},r?s.a.createElement("label",{"html-for":name},s.a.createElement(l.y,{sx:{color:"black"}},r)):null,s.a.createElement(c.d,a()({},t,{type:n,placeholder:i||r,autoComplete:u,border:1,p:"2 2",mt:1,onBlur:function(e){var r;t.onBlur(e),null==d||null===(r=d.mutators)||void 0===r||r.triggerValidation(t.name)}})),(p||f)&&(m&&s.a.createElement(l.C,{sx:{color:"red",mt:4.001}},m)||h&&s.a.createElement(l.C,{sx:{color:"red"}},h)))}d.propTypes={error:u.a.string,type:u.a.string,name:u.a.string,label:u.a.oneOfType([u.a.string,u.a.node]),placeholder:u.a.string,meta:u.a.object,input:u.a.object,autocomplete:u.a.string},d.defaultProps={autocomplete:null},r.a=d}}]); //# sourceMappingURL=auth-web-resetPassword-component.bundle.d6a5cd337238ff6fc3e9.js.map