@qratilabs/qrati-connect 2.5.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/element/{AuthLayout-EC2U3nsK.js → AuthLayout-IGFGeMq5.js} +1 -1
  3. package/element/{ContentsPage-BGtOyWxg.js → ContentsPage-Bu42OF-F.js} +1 -1
  4. package/element/{CuratePage-BLa771HN.js → CuratePage-CBMluidb.js} +1 -1
  5. package/element/{Dialog-D3m_eBiJ.js → Dialog-DVSvxBn8.js} +1 -1
  6. package/element/{DotLottiePlayer-FgGW1IR7.js → DotLottiePlayer-DHVhIw5H.js} +1 -1
  7. package/element/{EventHeaderAdminButtons-CW2SupWX.js → EventHeaderAdminButtons-zE3NbEUA.js} +1 -1
  8. package/element/{FolderBreadcrumb-CUpIfUTx.js → FolderBreadcrumb-1w72I1FP.js} +1 -1
  9. package/element/{ForgotPasswordPage-Cd0Oj-RE.js → ForgotPasswordPage-CIw8RrkZ.js} +1 -1
  10. package/element/{InputField-B_y35j-5.js → InputField-XP30segE.js} +1 -1
  11. package/element/{LazyLoadImage-CQL8-B3z.js → LazyLoadImage-n94OUygV.js} +1 -1
  12. package/element/{LeaderboardPage-BRBrFWpp.js → LeaderboardPage-CGuP207i.js} +1 -1
  13. package/element/{LoginPage-Ba9HTjV1.js → LoginPage-B15CMpYe.js} +1 -1
  14. package/element/{NCMVHL6D-CCAMoHuQ.js → NCMVHL6D-D_O5jdHL.js} +1 -1
  15. package/element/{PublicEvents-CddoYNW6.js → PublicEvents-DOp9N4xU.js} +1 -1
  16. package/element/{RegisterPage-DZGdPdu_.js → RegisterPage-D-6uVKjj.js} +1 -1
  17. package/element/{SocialLoginButton-BSK0uHQy.js → SocialLoginButton-BuZ03WV-.js} +1 -1
  18. package/element/{UploadPage-6k9f8u8c.js → UploadPage-Dhjmh06j.js} +1 -1
  19. package/element/{VideoPlayer-B6NcsNiP.js → VideoPlayer-cWSLl4fO.js} +1 -1
  20. package/element/element.es.js +1 -1
  21. package/element/{heic2any-JTWseCtt.js → heic2any-Dui1sz1X.js} +1 -1
  22. package/element/{index-Dq8XMn-B.js → index-DsN-W6V_.js} +1 -1
  23. package/element/{index-jVkC2DYJ.js → index-jzNVBihK.js} +1 -1
  24. package/element/{index.esm-mRBXJrk0.js → index.esm-CsbPHPGO.js} +1 -1
  25. package/element/{photoswipe-BdJR2C9a.js → photoswipe-5mcef1lI.js} +1 -1
  26. package/element/styles.css +1 -1
  27. package/element/{tslib.es6-CT89L4O4.js → tslib.es6-Dp_1P0Dk.js} +1 -1
  28. package/element/{useOrgAccess-DHToEbG_.js → useOrgAccess-B1cbGHT_.js} +1 -1
  29. package/element/web.es.js +1 -1
  30. package/package.json +1 -1
  31. package/react/{DPgWGmoG.js → 6xRxF6pz.js} +1 -1
  32. package/react/{BEzP8sbl.js → BZvhXg2G.js} +1 -1
  33. package/react/{BDeLdfbp.js → BaA7RHRf.js} +1 -1
  34. package/react/{CImTSnHg.js → Bebe5T7J.js} +1 -1
  35. package/react/{B5w5BP6w.js → C565I04Q.js} +1 -1
  36. package/react/{DPeVo4aL.js → CE-MbwCB.js} +1 -1
  37. package/react/{DH_wlDkr.js → CIlaT7eJ.js} +1 -1
  38. package/react/{JfRXqbqu.js → CS7icy9d.js} +1 -1
  39. package/react/{BUZq1uY0.js → Cp86U6va.js} +1 -1
  40. package/react/{LF1Cet66.js → Cv7EiFQU.js} +1 -1
  41. package/react/{eUvYQTPt.js → D1emifDo.js} +1 -1
  42. package/react/{BwHqpHe9.js → DPtqYlwJ.js} +1 -1
  43. package/react/{DcQdnYr8.js → DS2UD7gV.js} +1 -1
  44. package/react/{CYoLgOTC.js → DZitaH5o.js} +1 -1
  45. package/react/{CQHQocew.js → DjmC7CGh.js} +1 -1
  46. package/react/{BYYb8zAx.js → DwNWOPAY.js} +1 -1
  47. package/react/{6z8qI7He.js → Dyk2_V8r.js} +1 -1
  48. package/react/{CldWPPzn.js → LMErjmPc.js} +1 -1
  49. package/react/{BeDQQM0T.js → VOx0knsi.js} +1 -1
  50. package/react/{C-Ri1Eh9.js → W8TabW9M.js} +1 -1
  51. package/react/{CtX-oYOP.js → cWB0y40v.js} +1 -1
  52. package/react/index.es.js +1 -1
  53. package/react/{U9LCogz5.js → jM4FWKDA.js} +1 -1
  54. package/react/styles.css +1 -1
  55. package/react/{D464cx8y.js → vmkon26e.js} +1 -1
  56. package/umd/web.umd.js +2 -2
@@ -1 +1 @@
1
- import{j as e,a as r,u as n,T as o,O as t,k as a,l as s,Z as l,ab as i,P as c}from"./index-Dq8XMn-B.js";import{I as d}from"./InputField-B_y35j-5.js";import{u,o as m,c as f,C as p,a as h,b as g}from"./index.esm-mRBXJrk0.js";const v=({count:r=1,currentStep:n=0,disabled:o,onStepClick:t})=>{const a=o||!t;return e.jsx("ol",{role:"list",className:"qc:flex qc:items-center qc:space-x-4 qc:pl-1.5",children:Array.from({length:r}).map((r,o)=>e.jsx("li",{children:o<n?e.jsx("button",{className:"qc:bg-primary qc:block qc:size-3 qc:rounded-full",disabled:a,onClick:()=>t&&t(o)}):o===n?e.jsxs("button",{className:"qc:relative qc:flex qc:items-center qc:justify-center","aria-current":"step",disabled:a,onClick:()=>t&&t(o),children:[e.jsx("span",{className:"qc:absolute qc:flex qc:size-6 qc:p-px","aria-hidden":"true",children:e.jsx("span",{className:"qc:bg-primary qc:size-full qc:rounded-full qc:bg-opacity-40"})}),e.jsx("span",{className:"qc:bg-primary qc:relative qc:block qc:size-3 qc:rounded-full","aria-hidden":"true"})]}):e.jsx("button",{className:"qc:block qc:size-3 qc:rounded-full qc:bg-text-secondary-light",disabled:a,onClick:()=>t&&t(o)})},`progress-dot-${o}`))})},q={email:""},w=f().shape({email:h().required("Please enter your email").email("Enter a valid email")}),x=({onCodeSent:l})=>{const[i,c]=r.useState(!1),[f,h]=r.useState(null),{props:{organizationId:g}}=n(),{control:v,handleSubmit:x,formState:{errors:y}}=u({mode:"onSubmit",defaultValues:q,resolver:m(w)});return e.jsxs("div",{className:"w-full space-y-6",children:[e.jsx(o,{variant:"h5",align:"center",children:"Reset password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-4 qc:lg:space-y-8",onSubmit:x(async e=>{h(null),c(!0);try{await a.post(s.SEND_PASSWORD_RESET_CODE,{json:{email:e.email?.toLowerCase()},headers:{"x-org-id":g}}),l(e.email.toLowerCase())}catch(e){console.error("Error sending verification code:",e),h(e.message||e||"An error occurred while sending the code. Please try again.")}c(!1)}),children:[e.jsx(p,{name:"email",control:v,render:({field:{value:r,onChange:n,onBlur:o}})=>e.jsx(d,{label:"Email",disabled:i,type:"email",value:r,onChange:n,onBlur:o,error:y.email?.message})}),e.jsx(t,{fullWidth:!0,type:"submit",loading:i,children:"Send verification code"})]}),f&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:f})]})};var y=function(e){return"object"==typeof e&&null!==e},b=function(e){var r=e.value,n=void 0===r?"":r,o=e.numInputs,t=void 0===o?4:o,a=e.onChange,s=e.onPaste,i=e.renderInput,c=e.shouldAutoFocus,d=void 0!==c&&c,u=e.inputType,m=void 0===u?"text":u,f=e.renderSeparator,p=e.placeholder,h=e.containerStyle,g=e.inputStyle,v=e.skipDefaultStyles,q=void 0!==v&&v,w=l.useState(0),x=w[0],b=w[1],j=l.useRef([]),S=function(){return n?n.toString().split(""):[]},C="number"===m||"tel"===m;l.useEffect(function(){j.current=j.current.slice(0,t)},[t]),l.useEffect(function(){var e;d&&(null===(e=j.current[0])||void 0===e||e.focus())},[d]);var P=function(){if("string"==typeof p){if(p.length===t)return p;p.length>0&&console.error("Length of the placeholder should be equal to the number of inputs.")}},N=function(e){return(C?!isNaN(Number(e)):"string"==typeof e)&&1===e.trim().length},D=function(e){var r=e.target.value;N(r)&&(R(r),I(x+1))},E=function(e){var r=e.nativeEvent,n=e.target.value;if(!N(n)){if(n.length===t)n.split("").some(function(e){return!N(e)})||(O(n.split("")),I(t-1));null===r.data&&"deleteContentBackward"===r.inputType&&(e.preventDefault(),R(""),I(x-1)),e.target.value=""}},k=function(){b(x-1)},A=function(e){var r=S();[e.code,e.key].includes("Backspace")?(e.preventDefault(),R(""),I(x-1)):"Delete"===e.code?(e.preventDefault(),R("")):"ArrowLeft"===e.code?(e.preventDefault(),I(x-1)):"ArrowRight"===e.code||e.key===r[x]?(e.preventDefault(),I(x+1)):("Spacebar"===e.code||"Space"===e.code||"ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault()},I=function(e){var r,n,o=Math.max(Math.min(t-1,e),0);j.current[o]&&(null===(r=j.current[o])||void 0===r||r.focus(),null===(n=j.current[o])||void 0===n||n.select(),b(o))},R=function(e){var r=S();r[x]=e[0],O(r)},O=function(e){var r=e.join("");a(r)},B=function(e){var r;e.preventDefault();var n=S(),o=x,a=e.clipboardData.getData("text/plain").slice(0,t-x).split("");if(!C||!a.some(function(e){return isNaN(Number(e))})){for(var s=0;s<t;++s)s>=x&&a.length>0&&(n[s]=null!==(r=a.shift())&&void 0!==r?r:"",o++);I(o),O(n)}};return l.createElement("div",{style:Object.assign({display:"flex",alignItems:"center"},y(h)&&h),className:"string"==typeof h?h:void 0,onPaste:s},Array.from({length:t},function(e,r){return r}).map(function(e){var r,n,o;return l.createElement(l.Fragment,{key:e},i({value:null!==(r=S()[e])&&void 0!==r?r:"",placeholder:null!==(o=null===(n=P())||void 0===n?void 0:n[e])&&void 0!==o?o:void 0,ref:function(r){return j.current[e]=r},onChange:D,onFocus:function(r){return function(e){return function(r){b(r),e.target.select()}}(r)(e)},onBlur:k,onKeyDown:A,onPaste:B,autoComplete:"off","aria-label":"Please enter OTP character ".concat(e+1),style:Object.assign(q?{}:{width:"1em",textAlign:"center"},y(g)?g:{}),className:"string"==typeof g?g:void 0,type:m,inputMode:C?"numeric":"text",onInput:E},e),e<t-1&&("function"==typeof f?f(e):f))}))};const j={code:""},S=f().shape({code:h().required("Please enter the code")}),C=({email:l,onCodeVerified:i})=>{const{props:{organizationId:c}}=n(),[d,f]=r.useState(!1),[h,g]=r.useState(null),{control:v,handleSubmit:q,watch:w}=u({mode:"onSubmit",defaultValues:j,resolver:m(S)});return e.jsxs("div",{className:"qc:space-y-4 qc:lg:space-y-8",children:[e.jsxs(o,{variant:"h5",align:"center",children:["Enter the code sent to ",e.jsx("span",{className:"qc:text-primary qc:font-medium",children:l})]}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:flex qc:w-full qc:flex-col qc:items-center qc:gap-4 qc:lg:gap-8",onSubmit:q(async e=>{g(null),f(!0);try{await a.post(s.VERIFY_PASSWORD_RESET_CODE,{json:{email:l,code:e.code},headers:{"x-org-id":c}}),i&&i()}catch(e){console.error(e.message),g("An error occurred while verifying the code. Please try again.")}f(!1)}),children:[e.jsx(p,{name:"code",control:v,render:({field:{value:r,onChange:n}})=>e.jsx(b,{value:r,onChange:n,numInputs:6,shouldAutoFocus:!0,inputType:"number",isInputNum:!0,containerStyle:"qc:flex qc:gap-4",inputStyle:"qc:rounded qc:border qc:focus:border-primary qc:text-foreground qc:bg-white qc:disabled:border-border qc:disabled:text-gray-400 otp-input qc:text-xl qc:focus:outline-none qc:focus:ring-0 qc:focus:boder-none",renderInput:r=>e.jsx("input",{...r})})}),e.jsx(t,{fullWidth:!0,type:"submit",disabled:w("code").length<6,loading:d,children:"Submit"})]}),h&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:h})]})},P={password:"",confirmPassword:""},N=f().shape({password:h().required("Please enter your password").min(8,"Min password length is 8"),confirmPassword:h().required("Please confirm your password").min(8,"Min password length is 8").oneOf([g("password"),null],"Passwords do not match")}),D=({email:l,onPasswordReset:i})=>{const{props:{organizationId:c}}=n(),[f,h]=r.useState({showPassword:!1,showConfirmPassword:!1}),[g,v]=r.useState(!1),[q,w]=r.useState(null),{control:x,handleSubmit:y,formState:{errors:b}}=u({defaultValues:P,mode:"onSubmit",resolver:m(N)});return e.jsxs("div",{className:"qc:w-full qc:space-y-4",children:[e.jsx(o,{variant:"h5",align:"center",children:"Set new password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-8",onSubmit:y(async e=>{w(null),v(!0);try{const r=await a.post(s.RESET_PASSWORD,{json:{email:l.toLowerCase(),password:e.password},headers:{"x-org-id":c}});r.error?w(r.error):i()}catch{w("An error occurred while resetting the password. Please try again.")}v(!1)}),children:[e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"password",control:x,render:({field:{value:r,onChange:n,onBlur:o}})=>e.jsx(d,{label:"New password",disabled:g,type:f.showPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.password?.message})}),e.jsx(t,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showPassword:!f.showPassword})})]}),e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"confirmPassword",control:x,render:({field:{value:r,onChange:n,onBlur:o}})=>e.jsx(d,{label:"Confirm new password",disabled:g,type:f.showConfirmPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.confirmPassword?.message})}),e.jsx(t,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showConfirmPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showConfirmPassword:!f.showConfirmPassword})})]}),e.jsx(t,{fullWidth:!0,type:"submit",color:"primary",loading:g,children:"Reset password"})]}),q&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:q})]})},E=()=>{const n=i(),[o,t]=r.useState(null),[a,s]=r.useState(0);return e.jsxs("div",{className:"qc:space-y-9 qc:bg-background",children:[(({index:r})=>{switch(r){case 0:return e.jsx(x,{onCodeSent:e=>{t(e),s(1)}});case 1:return e.jsx(C,{email:o,onCodeVerified:()=>s(2)});case 2:return e.jsx(D,{email:o,onPasswordReset:()=>{n(c.LOGIN)}})}})({index:a}),e.jsx("div",{className:"qc:mt-8 qc:flex qc:justify-center",children:e.jsx(v,{count:3,currentStep:a})})]})};export{E as default};
1
+ import{j as e,a as r,u as n,T as o,O as t,k as a,l as s,Z as l,ab as i,P as c}from"./index-DsN-W6V_.js";import{I as d}from"./InputField-XP30segE.js";import{u,o as m,c as f,C as p,a as h,b as g}from"./index.esm-CsbPHPGO.js";const v=({count:r=1,currentStep:n=0,disabled:o,onStepClick:t})=>{const a=o||!t;return e.jsx("ol",{role:"list",className:"qc:flex qc:items-center qc:space-x-4 qc:pl-1.5",children:Array.from({length:r}).map((r,o)=>e.jsx("li",{children:o<n?e.jsx("button",{className:"qc:bg-primary qc:block qc:size-3 qc:rounded-full",disabled:a,onClick:()=>t&&t(o)}):o===n?e.jsxs("button",{className:"qc:relative qc:flex qc:items-center qc:justify-center","aria-current":"step",disabled:a,onClick:()=>t&&t(o),children:[e.jsx("span",{className:"qc:absolute qc:flex qc:size-6 qc:p-px","aria-hidden":"true",children:e.jsx("span",{className:"qc:bg-primary qc:size-full qc:rounded-full qc:bg-opacity-40"})}),e.jsx("span",{className:"qc:bg-primary qc:relative qc:block qc:size-3 qc:rounded-full","aria-hidden":"true"})]}):e.jsx("button",{className:"qc:block qc:size-3 qc:rounded-full qc:bg-text-secondary-light",disabled:a,onClick:()=>t&&t(o)})},`progress-dot-${o}`))})},q={email:""},w=f().shape({email:h().required("Please enter your email").email("Enter a valid email")}),x=({onCodeSent:l})=>{const[i,c]=r.useState(!1),[f,h]=r.useState(null),{props:{organizationId:g}}=n(),{control:v,handleSubmit:x,formState:{errors:y}}=u({mode:"onSubmit",defaultValues:q,resolver:m(w)});return e.jsxs("div",{className:"w-full space-y-6",children:[e.jsx(o,{variant:"h5",align:"center",children:"Reset password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-4 qc:lg:space-y-8",onSubmit:x(async e=>{h(null),c(!0);try{await a.post(s.SEND_PASSWORD_RESET_CODE,{json:{email:e.email?.toLowerCase()},headers:{"x-org-id":g}}),l(e.email.toLowerCase())}catch(e){console.error("Error sending verification code:",e),h(e.message||e||"An error occurred while sending the code. Please try again.")}c(!1)}),children:[e.jsx(p,{name:"email",control:v,render:({field:{value:r,onChange:n,onBlur:o}})=>e.jsx(d,{label:"Email",disabled:i,type:"email",value:r,onChange:n,onBlur:o,error:y.email?.message})}),e.jsx(t,{fullWidth:!0,type:"submit",loading:i,children:"Send verification code"})]}),f&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:f})]})};var y=function(e){return"object"==typeof e&&null!==e},b=function(e){var r=e.value,n=void 0===r?"":r,o=e.numInputs,t=void 0===o?4:o,a=e.onChange,s=e.onPaste,i=e.renderInput,c=e.shouldAutoFocus,d=void 0!==c&&c,u=e.inputType,m=void 0===u?"text":u,f=e.renderSeparator,p=e.placeholder,h=e.containerStyle,g=e.inputStyle,v=e.skipDefaultStyles,q=void 0!==v&&v,w=l.useState(0),x=w[0],b=w[1],j=l.useRef([]),S=function(){return n?n.toString().split(""):[]},C="number"===m||"tel"===m;l.useEffect(function(){j.current=j.current.slice(0,t)},[t]),l.useEffect(function(){var e;d&&(null===(e=j.current[0])||void 0===e||e.focus())},[d]);var P=function(){if("string"==typeof p){if(p.length===t)return p;p.length>0&&console.error("Length of the placeholder should be equal to the number of inputs.")}},N=function(e){return(C?!isNaN(Number(e)):"string"==typeof e)&&1===e.trim().length},D=function(e){var r=e.target.value;N(r)&&(R(r),I(x+1))},E=function(e){var r=e.nativeEvent,n=e.target.value;if(!N(n)){if(n.length===t)n.split("").some(function(e){return!N(e)})||(O(n.split("")),I(t-1));null===r.data&&"deleteContentBackward"===r.inputType&&(e.preventDefault(),R(""),I(x-1)),e.target.value=""}},k=function(){b(x-1)},A=function(e){var r=S();[e.code,e.key].includes("Backspace")?(e.preventDefault(),R(""),I(x-1)):"Delete"===e.code?(e.preventDefault(),R("")):"ArrowLeft"===e.code?(e.preventDefault(),I(x-1)):"ArrowRight"===e.code||e.key===r[x]?(e.preventDefault(),I(x+1)):("Spacebar"===e.code||"Space"===e.code||"ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault()},I=function(e){var r,n,o=Math.max(Math.min(t-1,e),0);j.current[o]&&(null===(r=j.current[o])||void 0===r||r.focus(),null===(n=j.current[o])||void 0===n||n.select(),b(o))},R=function(e){var r=S();r[x]=e[0],O(r)},O=function(e){var r=e.join("");a(r)},B=function(e){var r;e.preventDefault();var n=S(),o=x,a=e.clipboardData.getData("text/plain").slice(0,t-x).split("");if(!C||!a.some(function(e){return isNaN(Number(e))})){for(var s=0;s<t;++s)s>=x&&a.length>0&&(n[s]=null!==(r=a.shift())&&void 0!==r?r:"",o++);I(o),O(n)}};return l.createElement("div",{style:Object.assign({display:"flex",alignItems:"center"},y(h)&&h),className:"string"==typeof h?h:void 0,onPaste:s},Array.from({length:t},function(e,r){return r}).map(function(e){var r,n,o;return l.createElement(l.Fragment,{key:e},i({value:null!==(r=S()[e])&&void 0!==r?r:"",placeholder:null!==(o=null===(n=P())||void 0===n?void 0:n[e])&&void 0!==o?o:void 0,ref:function(r){return j.current[e]=r},onChange:D,onFocus:function(r){return function(e){return function(r){b(r),e.target.select()}}(r)(e)},onBlur:k,onKeyDown:A,onPaste:B,autoComplete:"off","aria-label":"Please enter OTP character ".concat(e+1),style:Object.assign(q?{}:{width:"1em",textAlign:"center"},y(g)?g:{}),className:"string"==typeof g?g:void 0,type:m,inputMode:C?"numeric":"text",onInput:E},e),e<t-1&&("function"==typeof f?f(e):f))}))};const j={code:""},S=f().shape({code:h().required("Please enter the code")}),C=({email:l,onCodeVerified:i})=>{const{props:{organizationId:c}}=n(),[d,f]=r.useState(!1),[h,g]=r.useState(null),{control:v,handleSubmit:q,watch:w}=u({mode:"onSubmit",defaultValues:j,resolver:m(S)});return e.jsxs("div",{className:"qc:space-y-4 qc:lg:space-y-8",children:[e.jsxs(o,{variant:"h5",align:"center",children:["Enter the code sent to ",e.jsx("span",{className:"qc:text-primary qc:font-medium",children:l})]}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:flex qc:w-full qc:flex-col qc:items-center qc:gap-4 qc:lg:gap-8",onSubmit:q(async e=>{g(null),f(!0);try{await a.post(s.VERIFY_PASSWORD_RESET_CODE,{json:{email:l,code:e.code},headers:{"x-org-id":c}}),i&&i()}catch(e){console.error(e.message),g("An error occurred while verifying the code. Please try again.")}f(!1)}),children:[e.jsx(p,{name:"code",control:v,render:({field:{value:r,onChange:n}})=>e.jsx(b,{value:r,onChange:n,numInputs:6,shouldAutoFocus:!0,inputType:"number",isInputNum:!0,containerStyle:"qc:flex qc:gap-4",inputStyle:"qc:rounded qc:border qc:focus:border-primary qc:text-foreground qc:bg-white qc:disabled:border-border qc:disabled:text-gray-400 otp-input qc:text-xl qc:focus:outline-none qc:focus:ring-0 qc:focus:boder-none",renderInput:r=>e.jsx("input",{...r})})}),e.jsx(t,{fullWidth:!0,type:"submit",disabled:w("code").length<6,loading:d,children:"Submit"})]}),h&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:h})]})},P={password:"",confirmPassword:""},N=f().shape({password:h().required("Please enter your password").min(8,"Min password length is 8"),confirmPassword:h().required("Please confirm your password").min(8,"Min password length is 8").oneOf([g("password"),null],"Passwords do not match")}),D=({email:l,onPasswordReset:i})=>{const{props:{organizationId:c}}=n(),[f,h]=r.useState({showPassword:!1,showConfirmPassword:!1}),[g,v]=r.useState(!1),[q,w]=r.useState(null),{control:x,handleSubmit:y,formState:{errors:b}}=u({defaultValues:P,mode:"onSubmit",resolver:m(N)});return e.jsxs("div",{className:"qc:w-full qc:space-y-4",children:[e.jsx(o,{variant:"h5",align:"center",children:"Set new password"}),e.jsxs("form",{noValidate:!0,autoComplete:"off",className:"qc:w-full qc:space-y-8",onSubmit:y(async e=>{w(null),v(!0);try{const r=await a.post(s.RESET_PASSWORD,{json:{email:l.toLowerCase(),password:e.password},headers:{"x-org-id":c}});r.error?w(r.error):i()}catch{w("An error occurred while resetting the password. Please try again.")}v(!1)}),children:[e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"password",control:x,render:({field:{value:r,onChange:n,onBlur:o}})=>e.jsx(d,{label:"New password",disabled:g,type:f.showPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.password?.message})}),e.jsx(t,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showPassword:!f.showPassword})})]}),e.jsxs("div",{className:"qc:relative",children:[e.jsx(p,{name:"confirmPassword",control:x,render:({field:{value:r,onChange:n,onBlur:o}})=>e.jsx(d,{label:"Confirm new password",disabled:g,type:f.showConfirmPassword?"text":"password",value:r,onChange:n,onBlur:o,error:b.confirmPassword?.message})}),e.jsx(t,{variant:"ghost",color:"primary",className:"qc:absolute qc:-right-4 qc:top-7",icon:f.showConfirmPassword?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>h({...f,showConfirmPassword:!f.showConfirmPassword})})]}),e.jsx(t,{fullWidth:!0,type:"submit",color:"primary",loading:g,children:"Reset password"})]}),q&&e.jsx(o,{variant:"h3",align:"center",color:"color",children:q})]})},E=()=>{const n=i(),[o,t]=r.useState(null),[a,s]=r.useState(0);return e.jsxs("div",{className:"qc:space-y-9 qc:bg-background",children:[(({index:r})=>{switch(r){case 0:return e.jsx(x,{onCodeSent:e=>{t(e),s(1)}});case 1:return e.jsx(C,{email:o,onCodeVerified:()=>s(2)});case 2:return e.jsx(D,{email:o,onPasswordReset:()=>{n(c.LOGIN)}})}})({index:a}),e.jsx("div",{className:"qc:mt-8 qc:flex qc:justify-center",children:e.jsx(v,{count:3,currentStep:a})})]})};export{E as default};
@@ -1 +1 @@
1
- import{u as e,j as c,c as t}from"./index-Dq8XMn-B.js";const r=({label:r,type:s="text",step:o=1,disabled:q,error:a,info:d,iconSVG:i,className:l="",...n})=>{const{props:{textClassName:m}}=e();return c.jsxs("div",{className:"qc:relative",children:[r&&c.jsx("div",{className:"qc:mb-1 qc:flex qc:items-center qc:gap-1",children:c.jsx("label",{className:t("qc:select-none qc:text-sm qc:font-medium",m,q?"qc:text-muted":"qc:text-foreground"),children:r})}),c.jsx("input",{type:s,disabled:q,step:"number"===s?o:void 0,"aria-invalid":!!a,className:t("qc:text-foreground qc:border-border qc:shadow-outer qc:focus:border-primary qc:focus:ring-primary qc:peer qc:w-full qc:rounded qc:border qc:p-2 qc:focus:outline-none",q?"qc:text-muted qc:bg-transparent":"qc:text-foreground qc:bg-white",a?"qc:border-destructive":"qc:border-border",i?"qc:pl-9":"",m,l),...n}),c.jsx("div",{className:t("qc:text-destructive qc:absolute qc:left-0 qc:flex qc:items-center qc:gap-1 qc:text-xs qc:transition-all qc:duration-300 qc:md:text-sm",a?"qc:-bottom-5 qc:opacity-100":"qc:-bottom-1 qc:opacity-0",m),children:c.jsx("label",{children:a})})]})};export{r as I};
1
+ import{u as e,j as c,c as t}from"./index-DsN-W6V_.js";const r=({label:r,type:s="text",step:o=1,disabled:q,error:a,info:d,iconSVG:i,className:l="",...n})=>{const{props:{textClassName:m}}=e();return c.jsxs("div",{className:"qc:relative",children:[r&&c.jsx("div",{className:"qc:mb-1 qc:flex qc:items-center qc:gap-1",children:c.jsx("label",{className:t("qc:select-none qc:text-sm qc:font-medium",m,q?"qc:text-muted":"qc:text-foreground"),children:r})}),c.jsx("input",{type:s,disabled:q,step:"number"===s?o:void 0,"aria-invalid":!!a,className:t("qc:text-foreground qc:border-border qc:shadow-outer qc:focus:border-primary qc:focus:ring-primary qc:peer qc:w-full qc:rounded qc:border qc:p-2 qc:focus:outline-none",q?"qc:text-muted qc:bg-transparent":"qc:text-foreground qc:bg-white",a?"qc:border-destructive":"qc:border-border",i?"qc:pl-9":"",m,l),...n}),c.jsx("div",{className:t("qc:text-destructive qc:absolute qc:left-0 qc:flex qc:items-center qc:gap-1 qc:text-xs qc:transition-all qc:duration-300 qc:md:text-sm",a?"qc:-bottom-5 qc:opacity-100":"qc:-bottom-1 qc:opacity-0",m),children:c.jsx("label",{children:a})})]})};export{r as I};
@@ -1 +1 @@
1
- import{a as t,j as e,c as r}from"./index-Dq8XMn-B.js";var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],s=t=>{let e=0;for(let r=0;r<t.length;r++){let s=t[r];e=83*e+i.indexOf(s)}return e},n=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},o=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},h=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),a=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},l=t=>{let e=t>>8&255,r=255&t;return[n(t>>16),n(e),n(r)]},c=(t,e)=>{let r=Math.floor(t/361),i=Math.floor(t/19)%19,s=t%19;return[h((r-9)/9,2)*e,h((i-9)/9,2)*e,h((s-9)/9,2)*e]},u=(t,e,r,i)=>{(t=>{if(!t||t.length<6)throw new a("The blurhash string must be at least 6 characters");let e=s(t[0]),r=Math.floor(e/9)+1,i=e%9+1;if(t.length!==4+2*i*r)throw new a(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*i*r}`)})(t),i|=1;let n=s(t[0]),h=Math.floor(n/9)+1,u=n%9+1,p=(s(t[1])+1)/166,d=new Array(u*h);for(let e=0;e<d.length;e++)if(0===e){let r=s(t.substring(2,6));d[e]=l(r)}else{let r=s(t.substring(4+2*e,6+2*e));d[e]=c(r,p*i)}let b=4*e,f=new Uint8ClampedArray(b*r);for(let t=0;t<r;t++)for(let i=0;i<e;i++){let s=0,n=0,a=0;for(let o=0;o<h;o++)for(let h=0;h<u;h++){let l=Math.cos(Math.PI*i*h/e)*Math.cos(Math.PI*t*o/r),c=d[h+o*u];s+=c[0]*l,n+=c[1]*l,a+=c[2]*l}let l=o(s),c=o(n),p=o(a);f[4*i+0+t*b]=l,f[4*i+1+t*b]=c,f[4*i+2+t*b]=p,f[4*i+3+t*b]=255}return f},p=Object.defineProperty,d=Object.defineProperties,b=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,v=(t,e,r)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&v(t,r,e[r]);if(f)for(var r of f(e))w.call(e,r)&&v(t,r,e[r]);return t},y=(t,e)=>d(t,b(e)),V=(t,e)=>{var r={};for(var i in t)g.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&f)for(var i of f(t))e.indexOf(i)<0&&w.call(t,i)&&(r[i]=t[i]);return r},M=class extends t.PureComponent{constructor(){super(...arguments),this.canvas=null,this.handleRef=t=>{this.canvas=t,this.draw()},this.draw=()=>{let{hash:t,height:e,punch:r,width:i}=this.props;if(this.canvas){let s=u(t,i,e,r),n=this.canvas.getContext("2d"),o=n.createImageData(i,e);o.data.set(s),n.putImageData(o,0,0)}}}componentDidUpdate(){this.draw()}render(){let e=this.props,{hash:r,height:i,width:s}=e,n=V(e,["hash","height","width"]);return t.createElement("canvas",y(m({},n),{height:i,width:s,ref:this.handleRef}))}};M.defaultProps={height:128,width:128};var I={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends t.PureComponent{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let e=this.props,{hash:r,height:i,width:s,punch:n,resolutionX:o,resolutionY:h,style:a}=e,l=V(e,["hash","height","width","punch","resolutionX","resolutionY","style"]);return t.createElement("div",y(m({},l),{style:y(m({display:"inline-block",height:i,width:s},a),{position:"relative"})}),t.createElement(M,{hash:r,height:h,width:o,punch:n,style:I}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var q=Object.defineProperty,C=(t,e,r)=>((t,e,r)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),j=new Map,k=new WeakMap,O=0;function x(t){return Object.keys(t).sort().filter(e=>void 0!==t[e]).map(e=>`${e}_${"root"===e?function(t){return t?(k.has(t)||(O+=1,k.set(t,O.toString())),k.get(t)):"0"}(t.root):t[e]}`).toString()}function E(t,e,r={},i=undefined){if(typeof window.IntersectionObserver>"u"&&void 0!==i){const s=t.getBoundingClientRect();return e(i,{isIntersecting:i,target:t,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}const{id:s,observer:n,elements:o}=function(t){const e=x(t);let r=j.get(e);if(!r){const i=new Map;let s;const n=new IntersectionObserver(e=>{e.forEach(e=>{var r;const n=e.isIntersecting&&s.some(t=>e.intersectionRatio>=t);t.trackVisibility&&typeof e.isVisible>"u"&&(e.isVisible=n),null==(r=i.get(e.target))||r.forEach(t=>{t(n,e)})})},t);s=n.thresholds||(Array.isArray(t.threshold)?t.threshold:[t.threshold||0]),r={id:e,observer:n,elements:i},j.set(e,r)}return r}(r),h=o.get(t)||[];return o.has(t)||o.set(t,h),h.push(e),n.observe(t),function(){h.splice(h.indexOf(e),1),0===h.length&&(o.delete(t),n.unobserve(t)),0===o.size&&(n.disconnect(),j.delete(s))}}var P=class extends t.Component{constructor(t){super(t),C(this,"node",null),C(this,"_unobserveCb",null),C(this,"lastInView"),C(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&(this.setState({inView:!!this.props.initialInView,entry:void 0}),this.lastInView=this.props.initialInView)),this.node=t||null,this.observeNode()}),C(this,"handleChange",(t,e)=>{const r=this.lastInView;this.lastInView=t,(void 0!==r||t)&&(t&&this.props.triggerOnce&&this.unobserve(),function(t){return"function"!=typeof t.children}(this.props)||this.setState({inView:t,entry:e}),this.props.onChange&&this.props.onChange(t,e))}),this.state={inView:!!t.initialInView,entry:void 0},this.lastInView=t.initialInView}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(t){(t.rootMargin!==this.props.rootMargin||t.root!==this.props.root||t.threshold!==this.props.threshold||t.skip!==this.props.skip||t.trackVisibility!==this.props.trackVisibility||t.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s,fallbackInView:n}=this.props;void 0===this.lastInView&&(this.lastInView=this.props.initialInView),this._unobserveCb=E(this.node,this.handleChange,{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s},n)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if("function"==typeof e){const{inView:t,entry:r}=this.state;return e({inView:t,entry:r,ref:this.handleNode})}const{as:r,triggerOnce:i,threshold:s,root:n,rootMargin:o,onChange:h,skip:a,trackVisibility:l,delay:c,initialInView:u,fallbackInView:p,...d}=this.props;return t.createElement(r||"div",{ref:this.handleNode,...d},e)}};const N=({src:i,alt:s,delayTime:n=0,threshold:o=.5,blurhash:h="LEHV6nWB2yk8pyo0adR*.7kCMdnj",wrapperClassName:a="qc:size-full",sizeMode:l="cover",position:c="center",onClick:u})=>{const p=t.useRef(null),d=t.useRef(null),[b,f]=t.useState(!1),[g,w]=t.useState(!1);return e.jsxs(P,{as:"div",className:r(a,"qc:relative qc:overflow-hidden"),threshold:o,onChange:t=>{t?d.current||(n<=0?f(!0):d.current=setTimeout(()=>f(!0),n)):d.current&&(clearTimeout(d.current),d.current=null)},children:[e.jsx(M,{className:"qc:size-full qc:blur-2xl",hash:h}),e.jsx("img",{alt:s,ref:p,src:b?i:null,onLoad:()=>w(!0),className:r("qc:bg-background qc:absolute qc:left-0 qc:top-0 qc:size-full qc:object-center qc:transition-all qc:duration-300",g?"qc:scale-100 qc:opacity-100":"qc:scale-95 qc:opacity-0","contain"===l?"qc:object-contain":"qc:object-cover","top"===c?"qc:object-top":"bottom"===c?"qc:object-bottom":"qc:object-center"),onClick:u})]})};export{P as I,N as L,u as j};
1
+ import{a as t,j as e,c as r}from"./index-DsN-W6V_.js";var i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],s=t=>{let e=0;for(let r=0;r<t.length;r++){let s=t[r];e=83*e+i.indexOf(s)}return e},n=t=>{let e=t/255;return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},o=t=>{let e=Math.max(0,Math.min(1,t));return e<=.0031308?Math.trunc(12.92*e*255+.5):Math.trunc(255*(1.055*Math.pow(e,.4166666666666667)-.055)+.5)},h=(t,e)=>(t=>t<0?-1:1)(t)*Math.pow(Math.abs(t),e),a=class extends Error{constructor(t){super(t),this.name="ValidationError",this.message=t}},l=t=>{let e=t>>8&255,r=255&t;return[n(t>>16),n(e),n(r)]},c=(t,e)=>{let r=Math.floor(t/361),i=Math.floor(t/19)%19,s=t%19;return[h((r-9)/9,2)*e,h((i-9)/9,2)*e,h((s-9)/9,2)*e]},u=(t,e,r,i)=>{(t=>{if(!t||t.length<6)throw new a("The blurhash string must be at least 6 characters");let e=s(t[0]),r=Math.floor(e/9)+1,i=e%9+1;if(t.length!==4+2*i*r)throw new a(`blurhash length mismatch: length is ${t.length} but it should be ${4+2*i*r}`)})(t),i|=1;let n=s(t[0]),h=Math.floor(n/9)+1,u=n%9+1,p=(s(t[1])+1)/166,d=new Array(u*h);for(let e=0;e<d.length;e++)if(0===e){let r=s(t.substring(2,6));d[e]=l(r)}else{let r=s(t.substring(4+2*e,6+2*e));d[e]=c(r,p*i)}let b=4*e,f=new Uint8ClampedArray(b*r);for(let t=0;t<r;t++)for(let i=0;i<e;i++){let s=0,n=0,a=0;for(let o=0;o<h;o++)for(let h=0;h<u;h++){let l=Math.cos(Math.PI*i*h/e)*Math.cos(Math.PI*t*o/r),c=d[h+o*u];s+=c[0]*l,n+=c[1]*l,a+=c[2]*l}let l=o(s),c=o(n),p=o(a);f[4*i+0+t*b]=l,f[4*i+1+t*b]=c,f[4*i+2+t*b]=p,f[4*i+3+t*b]=255}return f},p=Object.defineProperty,d=Object.defineProperties,b=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,v=(t,e,r)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,m=(t,e)=>{for(var r in e||(e={}))g.call(e,r)&&v(t,r,e[r]);if(f)for(var r of f(e))w.call(e,r)&&v(t,r,e[r]);return t},y=(t,e)=>d(t,b(e)),V=(t,e)=>{var r={};for(var i in t)g.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&f)for(var i of f(t))e.indexOf(i)<0&&w.call(t,i)&&(r[i]=t[i]);return r},M=class extends t.PureComponent{constructor(){super(...arguments),this.canvas=null,this.handleRef=t=>{this.canvas=t,this.draw()},this.draw=()=>{let{hash:t,height:e,punch:r,width:i}=this.props;if(this.canvas){let s=u(t,i,e,r),n=this.canvas.getContext("2d"),o=n.createImageData(i,e);o.data.set(s),n.putImageData(o,0,0)}}}componentDidUpdate(){this.draw()}render(){let e=this.props,{hash:r,height:i,width:s}=e,n=V(e,["hash","height","width"]);return t.createElement("canvas",y(m({},n),{height:i,width:s,ref:this.handleRef}))}};M.defaultProps={height:128,width:128};var I={position:"absolute",top:0,bottom:0,left:0,right:0,width:"100%",height:"100%"};(class extends t.PureComponent{componentDidUpdate(){if(this.props.resolutionX<=0)throw new Error("resolutionX must be larger than zero");if(this.props.resolutionY<=0)throw new Error("resolutionY must be larger than zero")}render(){let e=this.props,{hash:r,height:i,width:s,punch:n,resolutionX:o,resolutionY:h,style:a}=e,l=V(e,["hash","height","width","punch","resolutionX","resolutionY","style"]);return t.createElement("div",y(m({},l),{style:y(m({display:"inline-block",height:i,width:s},a),{position:"relative"})}),t.createElement(M,{hash:r,height:h,width:o,punch:n,style:I}))}}).defaultProps={height:128,width:128,resolutionX:32,resolutionY:32};var q=Object.defineProperty,C=(t,e,r)=>((t,e,r)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),j=new Map,k=new WeakMap,O=0;function x(t){return Object.keys(t).sort().filter(e=>void 0!==t[e]).map(e=>`${e}_${"root"===e?function(t){return t?(k.has(t)||(O+=1,k.set(t,O.toString())),k.get(t)):"0"}(t.root):t[e]}`).toString()}function E(t,e,r={},i=undefined){if(typeof window.IntersectionObserver>"u"&&void 0!==i){const s=t.getBoundingClientRect();return e(i,{isIntersecting:i,target:t,intersectionRatio:"number"==typeof r.threshold?r.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}const{id:s,observer:n,elements:o}=function(t){const e=x(t);let r=j.get(e);if(!r){const i=new Map;let s;const n=new IntersectionObserver(e=>{e.forEach(e=>{var r;const n=e.isIntersecting&&s.some(t=>e.intersectionRatio>=t);t.trackVisibility&&typeof e.isVisible>"u"&&(e.isVisible=n),null==(r=i.get(e.target))||r.forEach(t=>{t(n,e)})})},t);s=n.thresholds||(Array.isArray(t.threshold)?t.threshold:[t.threshold||0]),r={id:e,observer:n,elements:i},j.set(e,r)}return r}(r),h=o.get(t)||[];return o.has(t)||o.set(t,h),h.push(e),n.observe(t),function(){h.splice(h.indexOf(e),1),0===h.length&&(o.delete(t),n.unobserve(t)),0===o.size&&(n.disconnect(),j.delete(s))}}var P=class extends t.Component{constructor(t){super(t),C(this,"node",null),C(this,"_unobserveCb",null),C(this,"lastInView"),C(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&(this.setState({inView:!!this.props.initialInView,entry:void 0}),this.lastInView=this.props.initialInView)),this.node=t||null,this.observeNode()}),C(this,"handleChange",(t,e)=>{const r=this.lastInView;this.lastInView=t,(void 0!==r||t)&&(t&&this.props.triggerOnce&&this.unobserve(),function(t){return"function"!=typeof t.children}(this.props)||this.setState({inView:t,entry:e}),this.props.onChange&&this.props.onChange(t,e))}),this.state={inView:!!t.initialInView,entry:void 0},this.lastInView=t.initialInView}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(t){(t.rootMargin!==this.props.rootMargin||t.root!==this.props.root||t.threshold!==this.props.threshold||t.skip!==this.props.skip||t.trackVisibility!==this.props.trackVisibility||t.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s,fallbackInView:n}=this.props;void 0===this.lastInView&&(this.lastInView=this.props.initialInView),this._unobserveCb=E(this.node,this.handleChange,{threshold:t,root:e,rootMargin:r,trackVisibility:i,delay:s},n)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if("function"==typeof e){const{inView:t,entry:r}=this.state;return e({inView:t,entry:r,ref:this.handleNode})}const{as:r,triggerOnce:i,threshold:s,root:n,rootMargin:o,onChange:h,skip:a,trackVisibility:l,delay:c,initialInView:u,fallbackInView:p,...d}=this.props;return t.createElement(r||"div",{ref:this.handleNode,...d},e)}};const N=({src:i,alt:s,delayTime:n=0,threshold:o=.5,blurhash:h="LEHV6nWB2yk8pyo0adR*.7kCMdnj",wrapperClassName:a="qc:size-full",sizeMode:l="cover",position:c="center",onClick:u})=>{const p=t.useRef(null),d=t.useRef(null),[b,f]=t.useState(!1),[g,w]=t.useState(!1);return e.jsxs(P,{as:"div",className:r(a,"qc:relative qc:overflow-hidden"),threshold:o,onChange:t=>{t?d.current||(n<=0?f(!0):d.current=setTimeout(()=>f(!0),n)):d.current&&(clearTimeout(d.current),d.current=null)},children:[e.jsx(M,{className:"qc:size-full qc:blur-2xl",hash:h}),e.jsx("img",{alt:s,ref:p,src:b?i:null,onLoad:()=>w(!0),className:r("qc:bg-background qc:absolute qc:left-0 qc:top-0 qc:size-full qc:object-center qc:transition-all qc:duration-300",g?"qc:scale-100 qc:opacity-100":"qc:scale-95 qc:opacity-0","contain"===l?"qc:object-contain":"qc:object-cover","top"===c?"qc:object-top":"bottom"===c?"qc:object-bottom":"qc:object-center"),onClick:u})]})};export{P as I,N as L,u as j};
@@ -1 +1 @@
1
- import{j as e,T as c,d as t,u as s,M as a,f as l,c as i,S as r,B as n,k as q,l as d}from"./index-Dq8XMn-B.js";const o=({title:t,entries:s=[],showFloatingPoint:a=!1,hidePictures:l=!0})=>{const i=t.replace(/\s+/g,"-").toLowerCase(),r=e=>{if(!e)return"";const c=e.trim().split(" ");return 1===c.length?c[0]:`${c[0]} ${c[1][0]}.`};return e.jsxs("div",{className:"qc:border-border qc:mx-auto qc:flex qc:max-w-lg qc:flex-col qc:space-y-4 qc:rounded qc:border qc:p-4 qc:lg:space-y-8",children:[e.jsx(c,{variant:"h4",align:"center",color:"primary",children:t}),0===s.length?e.jsx(c,{variant:"h5",align:"center",color:"error",children:"Not available"}):e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"qc:flex qc:w-full qc:items-end qc:justify-center qc:gap-4 qc:lg:gap-24",children:[s.length>1&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-warning qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"2"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[1].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[1].totalPoint?s[1].maxScore?.toFixed(a?2:0):s[1].totalPoint?.toFixed(a?2:0)})]}),s.length>0&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-destructive qc:text-primary-foreground qc:flex qc:size-24 qc:items-center qc:justify-center qc:rounded-full qc:text-4xl",children:"1"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[0].name)}),e.jsx("div",{className:"qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[0].totalPoint?s[0].maxScore?.toFixed(a?2:0):s[0].totalPoint?.toFixed(a?2:0)})]}),s.length>2&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-success qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"3"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[2].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[2].totalPoint?s[2].maxScore?.toFixed(a?2:0):s[2].totalPoint?.toFixed(a?2:0)})]})]}),e.jsx("div",{className:"qc:mt-6",children:e.jsx("div",{className:"qc:-my-2 qc:overflow-x-auto qc:sm:-mx-6 qc:lg:-mx-8",children:e.jsx("div",{className:"qc:inline-block qc:min-w-full qc:py-2 qc:align-middle qc:md:px-6 qc:lg:px-8",children:e.jsx("div",{className:"qc:shadow-outer qc:overflow-hidden qc:ring-1 qc:ring-black qc:ring-opacity-5 qc:md:rounded",children:e.jsx("table",{className:"qc:w-full qc:divide-y qc:divide-gray-300",children:e.jsx("tbody",{className:"qc:bg-background qc:bg-opacity-50",children:s.slice(3).map((c,t)=>e.jsxs("tr",{children:[e.jsx("td",{className:"qc:text-muted qc:whitespace-nowrap qc:py-4 qc:pl-4 qc:text-sm qc:font-medium",children:e.jsx("span",{className:"qc:px-2",children:t+4})}),e.jsx("td",{className:"qc:whitespace-nowrap qc:py-4",children:e.jsxs("div",{className:"qc:flex qc:items-center",children:[!l&&e.jsx("div",{className:"qc:size-8 qc:shrink-0"}),e.jsx("div",{className:"qc-ml-4",children:e.jsx("div",{className:"qc-text-primary qc-font-medium",children:r(c.name)})})]})}),e.jsx("td",{className:"qc:text-foreground qc:whitespace-nowrap qc:py-4 qc:pr-4 qc:text-right qc:text-base qc:font-medium qc:italic",children:void 0===c.totalPoint?c.maxScore?.toFixed(a?2:0):c.totalPoint?.toFixed(a?2:0)})]},`${i}-${t}`))})})})})})})]})]})},x=()=>{const{eventSlug:c}=t(),{props:{organizationId:x}}=s(),{event:m}=a({eventSlug:c}),{isLoading:f,data:g}=l({queryKey:[`leaderboard-${x}-${m?._id}`],queryFn:async()=>(await q.get(d.GET_LEADERBOARD,{headers:{"x-org-id":x},searchParams:{eventId:m?._id}}).json()).data,enabled:!!m});return f?e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:bg-background qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsxs("div",{className:"qc:flex-1",children:[e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"}),e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"})]}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:g?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]}):e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:"Point Leaders",entries:g?.leaderboardByPoint?.topRankers||[],pointName:m?.pointName})}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:g?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]})};export{x as default};
1
+ import{j as e,T as c,d as t,u as s,M as a,f as l,c as i,S as r,B as n,k as q,l as d}from"./index-DsN-W6V_.js";const o=({title:t,entries:s=[],showFloatingPoint:a=!1,hidePictures:l=!0})=>{const i=t.replace(/\s+/g,"-").toLowerCase(),r=e=>{if(!e)return"";const c=e.trim().split(" ");return 1===c.length?c[0]:`${c[0]} ${c[1][0]}.`};return e.jsxs("div",{className:"qc:border-border qc:mx-auto qc:flex qc:max-w-lg qc:flex-col qc:space-y-4 qc:rounded qc:border qc:p-4 qc:lg:space-y-8",children:[e.jsx(c,{variant:"h4",align:"center",color:"primary",children:t}),0===s.length?e.jsx(c,{variant:"h5",align:"center",color:"error",children:"Not available"}):e.jsxs("div",{className:"",children:[e.jsxs("div",{className:"qc:flex qc:w-full qc:items-end qc:justify-center qc:gap-4 qc:lg:gap-24",children:[s.length>1&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-warning qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"2"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[1].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[1].totalPoint?s[1].maxScore?.toFixed(a?2:0):s[1].totalPoint?.toFixed(a?2:0)})]}),s.length>0&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-destructive qc:text-primary-foreground qc:flex qc:size-24 qc:items-center qc:justify-center qc:rounded-full qc:text-4xl",children:"1"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[0].name)}),e.jsx("div",{className:"qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[0].totalPoint?s[0].maxScore?.toFixed(a?2:0):s[0].totalPoint?.toFixed(a?2:0)})]}),s.length>2&&e.jsxs("div",{className:"qc:flex qc:flex-col qc:items-center qc:justify-center",children:[e.jsx("div",{className:"qc:bg-success qc:text-primary-foreground qc:flex qc:size-16 qc:items-center qc:justify-center qc:rounded-full qc:text-2xl",children:"3"}),e.jsx("div",{className:"qc-text-primary qc-mt-3 qc-text-center qc-font-semibold",children:r(s[2].name)}),e.jsx("div",{className:"qc:text-foreground qc:text-primary qc:mt-1 qc:text-center qc:font-semibold",children:void 0===s[2].totalPoint?s[2].maxScore?.toFixed(a?2:0):s[2].totalPoint?.toFixed(a?2:0)})]})]}),e.jsx("div",{className:"qc:mt-6",children:e.jsx("div",{className:"qc:-my-2 qc:overflow-x-auto qc:sm:-mx-6 qc:lg:-mx-8",children:e.jsx("div",{className:"qc:inline-block qc:min-w-full qc:py-2 qc:align-middle qc:md:px-6 qc:lg:px-8",children:e.jsx("div",{className:"qc:shadow-outer qc:overflow-hidden qc:ring-1 qc:ring-black qc:ring-opacity-5 qc:md:rounded",children:e.jsx("table",{className:"qc:w-full qc:divide-y qc:divide-gray-300",children:e.jsx("tbody",{className:"qc:bg-background qc:bg-opacity-50",children:s.slice(3).map((c,t)=>e.jsxs("tr",{children:[e.jsx("td",{className:"qc:text-muted qc:whitespace-nowrap qc:py-4 qc:pl-4 qc:text-sm qc:font-medium",children:e.jsx("span",{className:"qc:px-2",children:t+4})}),e.jsx("td",{className:"qc:whitespace-nowrap qc:py-4",children:e.jsxs("div",{className:"qc:flex qc:items-center",children:[!l&&e.jsx("div",{className:"qc:size-8 qc:shrink-0"}),e.jsx("div",{className:"qc-ml-4",children:e.jsx("div",{className:"qc-text-primary qc-font-medium",children:r(c.name)})})]})}),e.jsx("td",{className:"qc:text-foreground qc:whitespace-nowrap qc:py-4 qc:pr-4 qc:text-right qc:text-base qc:font-medium qc:italic",children:void 0===c.totalPoint?c.maxScore?.toFixed(a?2:0):c.totalPoint?.toFixed(a?2:0)})]},`${i}-${t}`))})})})})})})]})]})},x=()=>{const{eventSlug:c}=t(),{props:{organizationId:x}}=s(),{event:m}=a({eventSlug:c}),{isLoading:f,data:g}=l({queryKey:[`leaderboard-${x}-${m?._id}`],queryFn:async()=>(await q.get(d.GET_LEADERBOARD,{headers:{"x-org-id":x},searchParams:{eventId:m?._id}}).json()).data,enabled:!!m});return f?e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:bg-background qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsxs("div",{className:"qc:flex-1",children:[e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"}),e.jsx(r,{className:"qc:h-64 qc:w-full qc:rounded"})]}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:g?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]}):e.jsxs("div",{className:i("qc:mt-4 qc:flex qc:min-h-[80vh] qc:w-full qc:gap-8 qc:px-2 qc:py-4 qc:sm:px-0 qc:lg:gap-0 qc:lg:py-8",m?.engagementStyle===n.REACTION?"qc:flex-col-reverse qc:md:flex-row-reverse qc:md:justify-between":"qc:flex-col qc:md:flex-row"),children:[e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:"Point Leaders",entries:g?.leaderboardByPoint?.topRankers||[],pointName:m?.pointName})}),e.jsx("div",{className:"qc:flex-1",children:e.jsx(o,{title:m?.engagementStyle===n.REACTION?"Reaction Counts":"Top Rated Photos",showFloatingPoint:m?.engagementStyle===n.CONTEST,entries:g?.leaderboardByScore?.topRankers||[],pointName:m?.pointName})})]})};export{x as default};
@@ -1 +1 @@
1
- import{a as e,e as a,u as s,j as l,O as o,T as r,h as i,P as t}from"./index-Dq8XMn-B.js";import{I as n}from"./InputField-B_y35j-5.js";import{S as c}from"./SocialLoginButton-BSK0uHQy.js";import{u as d,C as m,o as p,c as g,a as u}from"./index.esm-mRBXJrk0.js";const h=g().shape({email:u().required("Please enter your email").email("Enter a valid email"),password:u().required("Please enter your password").min(8,"Min password length is 8")}),j=()=>{const[g,u]=e.useState(!1),[j,x]=e.useState(!1),[f,q]=e.useState({google:!1,apple:!1}),[w,y]=e.useState(null),v=a(),{control:b,handleSubmit:C,formState:{errors:S}}=d({defaultValues:{email:"",password:""},mode:"onSubmit",resolver:p(h)}),{loginUsingEmail:N,loginWithGoogle:B,loginWithApple:P}=s(),k=async(e,a)=>{q(a=>({...a,[e]:!0})),y(null);try{await a()}catch(a){y(a.message||`Failed to login with ${e.charAt(0).toUpperCase()+e.slice(1)}`)}finally{q(a=>({...a,[e]:!1}))}};return l.jsxs("div",{className:"qc:w-full qc:space-y-6 qc:bg-background",children:[l.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:C(async e=>{const{email:a,password:s}=e;x(!0);try{const e=await N(a.toLowerCase(),s);e?.error&&y(e.error)}catch(e){y(e)}finally{x(!1)}}),className:"qc:space-y-6",children:[l.jsxs("div",{className:"qc:space-y-9",children:[l.jsx(m,{name:"email",control:b,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsx(n,{label:"Email",disabled:j,type:"email",value:e,onChange:a,onBlur:s,autoComplete:"email",error:S.email?.message})}),l.jsx(m,{name:"password",control:b,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsxs("div",{className:"qc:relative",children:[l.jsx(n,{label:"Password",disabled:j,type:g?"text":"password",value:e,onChange:a,onBlur:s,autoComplete:"current-password",error:S.password?.message}),l.jsx(o,{variant:"ghost",color:"primary",className:"qc:absolute qc:right-0 qc:top-8",icon:g?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>u(!g)})]})})]}),w&&l.jsx(r,{align:"center",weight:"medium",color:"error",children:w}),l.jsx("div",{className:"qc:flex qc:justify-end",children:l.jsx(i,{to:t.FORGOT_PASSWORD,state:v?.state,children:l.jsx(r,{variant:"h6",className:"qc:w-fit",children:"Forgot password?"})})}),l.jsx(o,{type:"submit",color:"primary",className:"qc:w-full",loading:j,disabled:j,children:"Login"})]}),l.jsxs("div",{className:"qc:grid qc:grid-cols-2 qc:gap-4",children:[l.jsx(c,{disabled:j||f.google||f.apple,loading:f.google,onClick:()=>k("google",B),provider:"google"}),l.jsx(c,{disabled:j||f.google||f.apple,loading:f.apple,onClick:()=>k("apple",P),provider:"apple"})]})]})};export{j as default};
1
+ import{a as e,e as a,u as s,j as l,O as o,T as r,h as i,P as t}from"./index-DsN-W6V_.js";import{I as n}from"./InputField-XP30segE.js";import{S as c}from"./SocialLoginButton-BuZ03WV-.js";import{u as d,C as m,o as p,c as g,a as u}from"./index.esm-CsbPHPGO.js";const h=g().shape({email:u().required("Please enter your email").email("Enter a valid email"),password:u().required("Please enter your password").min(8,"Min password length is 8")}),j=()=>{const[g,u]=e.useState(!1),[j,x]=e.useState(!1),[f,q]=e.useState({google:!1,apple:!1}),[w,y]=e.useState(null),v=a(),{control:b,handleSubmit:C,formState:{errors:S}}=d({defaultValues:{email:"",password:""},mode:"onSubmit",resolver:p(h)}),{loginUsingEmail:N,loginWithGoogle:B,loginWithApple:P}=s(),k=async(e,a)=>{q(a=>({...a,[e]:!0})),y(null);try{await a()}catch(a){y(a.message||`Failed to login with ${e.charAt(0).toUpperCase()+e.slice(1)}`)}finally{q(a=>({...a,[e]:!1}))}};return l.jsxs("div",{className:"qc:w-full qc:space-y-6 qc:bg-background",children:[l.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:C(async e=>{const{email:a,password:s}=e;x(!0);try{const e=await N(a.toLowerCase(),s);e?.error&&y(e.error)}catch(e){y(e)}finally{x(!1)}}),className:"qc:space-y-6",children:[l.jsxs("div",{className:"qc:space-y-9",children:[l.jsx(m,{name:"email",control:b,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsx(n,{label:"Email",disabled:j,type:"email",value:e,onChange:a,onBlur:s,autoComplete:"email",error:S.email?.message})}),l.jsx(m,{name:"password",control:b,render:({field:{value:e,onChange:a,onBlur:s}})=>l.jsxs("div",{className:"qc:relative",children:[l.jsx(n,{label:"Password",disabled:j,type:g?"text":"password",value:e,onChange:a,onBlur:s,autoComplete:"current-password",error:S.password?.message}),l.jsx(o,{variant:"ghost",color:"primary",className:"qc:absolute qc:right-0 qc:top-8",icon:g?"mdi:eye-outline":"mdi:eye-off-outline",onClick:()=>u(!g)})]})})]}),w&&l.jsx(r,{align:"center",weight:"medium",color:"error",children:w}),l.jsx("div",{className:"qc:flex qc:justify-end",children:l.jsx(i,{to:t.FORGOT_PASSWORD,state:v?.state,children:l.jsx(r,{variant:"h6",className:"qc:w-fit",children:"Forgot password?"})})}),l.jsx(o,{type:"submit",color:"primary",className:"qc:w-full",loading:j,disabled:j,children:"Login"})]}),l.jsxs("div",{className:"qc:grid qc:grid-cols-2 qc:gap-4",children:[l.jsx(c,{disabled:j||f.google||f.apple,loading:f.google,onClick:()=>k("google",B),provider:"google"}),l.jsx(c,{disabled:j||f.google||f.apple,loading:f.apple,onClick:()=>k("apple",P),provider:"apple"})]})]})};export{j as default};