harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
1 lines • 12.6 kB
JavaScript
;(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[75],{3550:(e,t,n)=>{n.r(t),n.d(t,{default:()=>m});var r=n(9379),o=n(9950),i=n(9708),c=n(1646),s=n(5488),a=n(3452),l=n(9163),u=n.n(l),f=n(5077),p=n(1440),d=n(2714);var b=n(4979),y=n(4414);const m=function(){const[e,t]=(0,o.useState)({}),[n,l]=(0,o.useState)({});return u()((async()=>{const{submitted:r,processing:o}=e;let i;if(r&&!o){const{email:e}=n;if((0,p.A)(e)){t({processing:!0});const n=await(async e=>{let{email:t,login_domain:n=window.location.host}=e;return(0,d.A)({endpoint:"resetPassword",method:"POST",payload:{email:t,login_domain:n}})})({email:e});n.error&&"User does not exist"!==n.message?(t({error:n.message}),i=setTimeout((()=>t({})),5e3)):t({success:!0})}else t({error:"A valid email is required"}),i=setTimeout((()=>t({})),5e3)}return()=>{clearTimeout(i)}}),[e]),u()((()=>{e.submitted||t({})}),[n]),(0,y.jsx)("div",{className:"login-form",children:e.processing?(0,y.jsx)(b.A,{header:"Resetting password",spinner:!0,relative:!0}):e.success?(0,y.jsx)(b.A,{header:"success!",body:"Check the provided email for a temporary password.",links:[{to:"/",text:"Go to Sign In",className:"text-center"}],relative:!0}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(i.A,{children:[(0,y.jsx)("h2",{className:"mb-2 instructions",children:"Enter your account email"}),(0,y.jsx)("span",{className:"mb-2 d-inline-block",children:"If a matching account exists, we'll send you a password reset link."}),(0,y.jsx)("span",{className:"login-nav-link error d-inline-block",children:e.error}),(0,y.jsxs)(c.A,{className:"mb-3 d-block",children:[(0,y.jsx)("span",{className:"mb-2 d-inline-block",children:"Email"}),(0,y.jsx)(s.A,{name:"email",autoComplete:"email",required:!0,id:"email",onChange:e=>{e.currentTarget.focus(),l((0,r.A)((0,r.A)({},n),{},{email:e.target.value.trim().toLowerCase()}))},value:n.email||"",disabled:e.submitted,type:"text",title:"email",placeholder:"email address"})]}),(0,y.jsx)(a.A,{id:"sendPasswordResetEmail",onClick:()=>t({submitted:!0}),disabled:e.submitted,className:"border-0 rounded-pill btn-gradient-blue",title:"Send Password Reset Email",block:!0,type:"submit",color:"purple",children:"Send Password Reset Email"})]}),(0,y.jsxs)("div",{className:"px-4 mt-3 d-flex justify-content-between",children:[(0,y.jsx)(f.k2,{to:"/",className:"login-nav-link d-inline-block",children:"Back to Sign In"}),(0,y.jsx)(f.k2,{to:"/sign-up",className:"login-nav-link d-inline-block",children:"Sign Up for Free"})]})]})})}},1440:(e,t,n)=>{n.d(t,{A:()=>r});const r=e=>/^\S+@\S+\.\S+$/.test(String(e).toLowerCase())},9708:(e,t,n)=>{n.d(t,{A:()=>v});var r=n(9950),o=n(1942),i=n.n(o),c=n(1497);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}var a=["className","cssModule","tag","innerRef"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function d(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=y(e);if(t){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}(this,n)}}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var m={children:i().node,tag:c.Wx,innerRef:i().oneOfType([i().object,i().func,i().string]),className:i().string,cssModule:i().object},h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(s,e);var t,n,o,i=d(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this,e)).getRef=t.getRef.bind(b(t)),t.submit=t.submit.bind(b(t)),t}return t=s,(n=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"submit",value:function(){this.ref&&this.ref.submit()}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.cssModule,o=e.tag,i=void 0===o?"form":o,s=e.innerRef,f=u(e,a),p=(0,c.qO)(t,n);return r.createElement(i,l({},f,{ref:s,className:p}))}}])&&f(t.prototype,n),o&&f(t,o),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);h.propTypes=m;const v=h},5488:(e,t,n)=>{n.d(t,{A:()=>O});var r=n(9950),o=n(1942),i=n.n(o),c=n(8738),s=n.n(c),a=n(1497);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}var u=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(this,arguments)}function p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function y(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=h(e);if(t){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===l(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,n)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}var v={children:i().node,type:i().string,size:i().oneOfType([i().number,i().string]),bsSize:i().string,valid:i().bool,invalid:i().bool,tag:a.Wx,innerRef:i().oneOfType([i().object,i().func,i().string]),plaintext:i().bool,addon:i().bool,className:i().string,cssModule:i().object},g=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(c,e);var t,n,o,i=y(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=i.call(this,e)).getRef=t.getRef.bind(m(t)),t.focus=t.focus.bind(m(t)),t}return t=c,(n=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.cssModule,o=e.type,i=void 0===o?"text":o,c=e.bsSize,l=e.valid,d=e.invalid,b=e.tag,y=e.addon,m=e.plaintext,h=e.innerRef,v=p(e,u),g=["switch","radio","checkbox"].indexOf(i)>-1,O="select"===i,j="range"===i,w=b||(O||"textarea"===i?i:"input"),x="form-control";m?(x="".concat(x,"-plaintext"),w=b||"input"):j?x="form-range":O?x="form-select":g&&(x=y?null:"form-check-input"),v.size&&/\D/g.test(v.size)&&((0,a.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),c=v.size,delete v.size);var k=(0,a.qO)(s()(t,d&&"is-invalid",l&&"is-valid",!!c&&(O?"form-select-".concat(c):"form-control-".concat(c)),x),n);return("input"===w||b&&"function"===typeof b)&&(v.type="switch"===i?"checkbox":i),v.children&&!m&&"select"!==i&&"string"===typeof w&&"select"!==w&&((0,a.mc)('Input with a type of "'.concat(i,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete v.children),r.createElement(w,f({},v,{ref:h,className:k,"aria-invalid":d}))}}])&&d(t.prototype,n),o&&d(t,o),Object.defineProperty(t,"prototype",{writable:!1}),c}(r.Component);g.propTypes=v;const O=g},1646:(e,t,n)=>{n.d(t,{A:()=>g});var r=n(9950),o=n(1942),i=n.n(o),c=n(8738),s=n.n(c),a=n(1497),l=["className","cssModule","hidden","widths","tag","check","size","for"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(this,arguments)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var d=["xs","sm","md","lg","xl","xxl"],b=i().oneOfType([i().number,i().string]),y=i().oneOfType([i().bool,i().string,i().number,i().shape({size:b,order:b,offset:b})]),m={children:i().node,hidden:i().bool,check:i().bool,size:i().string,for:i().string,tag:a.Wx,className:i().string,cssModule:i().object,xs:y,sm:y,md:y,lg:y,xl:y,xxl:y,widths:i().array},h=function(e,t,n){return!0===n||""===n?e?"col":"col-".concat(t):"auto"===n?e?"col-auto":"col-".concat(t,"-auto"):e?"col-".concat(n):"col-".concat(t,"-").concat(n)};function v(e){var t=e.className,n=e.cssModule,o=e.hidden,i=e.widths,c=void 0===i?d:i,b=e.tag,y=void 0===b?"label":b,m=e.check,v=e.size,g=e.for,O=p(e,l),j=[];c.forEach((function(t,r){var o=e[t];if(delete O[t],o||""===o){var i,c=!r;if((0,a.Gv)(o)){var l,u=c?"-":"-".concat(t,"-");i=h(c,t,o.size),j.push((0,a.qO)(s()((f(l={},i,o.size||""===o.size),f(l,"order".concat(u).concat(o.order),o.order||0===o.order),f(l,"offset".concat(u).concat(o.offset),o.offset||0===o.offset),l))),n)}else i=h(c,t,o),j.push(i)}}));var w=v||j.length,x=!(m||w),k=(0,a.qO)(s()(t,!!o&&"visually-hidden",!!m&&"form-check-label",!!v&&"col-form-label-".concat(v),j,!!w&&"col-form-label",!!x&&"form-label"),n);return r.createElement(y,u({htmlFor:g},O,{className:k}))}v.propTypes=m;const g=v},9163:(e,t,n)=>{var r=n(9950);function o(e,t,n){var o="function"===typeof t;r.useEffect((function(){var n,r=!0,i=e((function(){return r}));return Promise.resolve(i).then((function(e){n=e})),function(){r=!1,o&&t(n)}}),o?n:t)}e.exports=o,e.exports.useAsyncEffect=o}}]);