@prefabs.tech/vue3-user 0.28.0 → 0.29.0

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.
@@ -1,4 +1,4 @@
1
- (function(be,xe){typeof exports=="object"&&typeof module<"u"?xe(exports,require("@prefabs.tech/vue3-i18n"),require("vue"),require("axios"),require("pinia"),require("supertokens-web-js"),require("supertokens-web-js/recipe/emailverification"),require("supertokens-web-js/recipe/session"),require("supertokens-web-js/recipe/thirdpartyemailpassword"),require("supertokens-web-js/recipe/userroles"),require("supertokens-website"),require("@prefabs.tech/vue3-config"),require("@prefabs.tech/vue3-ui"),require("vue-router"),require("zod"),require("vee-validate"),require("@vueuse/core"),require("@prefabs.tech/vue3-layout")):typeof define=="function"&&define.amd?define(["exports","@prefabs.tech/vue3-i18n","vue","axios","pinia","supertokens-web-js","supertokens-web-js/recipe/emailverification","supertokens-web-js/recipe/session","supertokens-web-js/recipe/thirdpartyemailpassword","supertokens-web-js/recipe/userroles","supertokens-website","@prefabs.tech/vue3-config","@prefabs.tech/vue3-ui","vue-router","zod","vee-validate","@vueuse/core","@prefabs.tech/vue3-layout"],xe):(be=typeof globalThis<"u"?globalThis:be||self,xe(be.PrefabsTechVue3User={},be.PrefabsTechVue3I18n,be.Vue,be.Axios,be.Pinia,be.SupertokensWebJs,be.SupertokensWebJsRecipeEmailverification,be.SupertokensWebJsRecipeSession,be.SupertokensWebJsRecipeThirdpartyemailpassword,be.SupertokensWebJsRecipeUserroles,be.SupertokensWebsite,be.PrefabsTechVue3Config,be.PrefabsTechVue3UI,be.VueRouter,be.Zod,be.Veevalidate,be.VueuseCore,be.PrefabsTechVue3Layout))})(this,function(be,xe,r,jr,bt,Fm,kn,Nr,Tr,Qi,Lm,We,he,ut,Ue,dt,qm,Jr){"use strict";function Um(e){return{all:e=e||new Map,on:function(t,a){var n=e.get(t);n?n.push(a):e.set(t,[a])},off:function(t,a){var n=e.get(t);n&&(a?n.splice(n.indexOf(a)>>>0,1):e.set(t,[]))},emit:function(t,a){var n=e.get(t);n&&n.slice().map(function(o){o(a)}),(n=e.get("*"))&&n.slice().map(function(o){o(t,a)})}}}const Hm="/api/user/change-email-username",Gm="/api/user/change-password",zm="/api/email/verification-status",Ym="/api/login",Wm="/api/logout",Zm="/api/me",Km="/api/reset-password",Xm="/api/reset-password-request",jm="/api/login/refresh",Jm="/api/email/send-verification",Qm="/api/signup",eg="/api/profile",tg="/api/email/verify",rg="/auth/callback/facebook",ag="/auth/callback/google";var Jt=(e=>(e.EMAIL_ALREADY_VERIFIED="EMAIL_ALREADY_VERIFIED",e.EMAIL_ALREADY_VERIFIED_ERROR="EMAIL_ALREADY_VERIFIED_ERROR",e.EMAIL_VERIFICATION_INVALID_TOKEN_ERROR="EMAIL_VERIFICATION_INVALID_TOKEN_ERROR",e.ERROR="ERROR",e.OK="OK",e))(Jt||{});const eu=404,ng="ROLE_ALREADY_EXISTS",og=401,tu="accepted",ru="expired",au="pending",nu="revoked",jl="username",Qr="ADMIN",ou="SUPERADMIN",lu="USER",su="facebook",iu="google",Or="ERROR",uu="OK",lg="/auth",sg=async(e,t,a)=>{try{return(await ze(t).put(a,{email:e},{withCredentials:!0})).statusText}catch(n){if(n.response){const{data:o}=n.response;return{status:o.status,message:o.message}}return{status:"ERROR",message:"Oops! Something went wrong"}}},ig=async(e,t,a)=>{let n,o;try{if(o=await ze(t).put(a,e,{withCredentials:!0}),o.status===200)return n=o.data,n}catch(l){throw l instanceof jr.AxiosError?l.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},ug=async(e,t,a)=>{const n=await ze(a).post(`invitations/token/${e}`,t,{withCredentials:!0});if(n.data.status===Or)throw new Error(n.data.message);return n.data},dg=async(e,t)=>{const a=await ze(t).post("/invitations",e,{withCredentials:!0});if(a.data.status===Or)throw new Error(a.data.message);return a.data},cg=async(e,t)=>{const a=await ze(t).put(`users/${e}/disable`,{},{withCredentials:!0});if(a.status===eu)throw new Error(a.data.message);return a},fg=async(e,t)=>{const a=await ze(t).put(`users/${e}/enable`,{},{withCredentials:!0});if(a.status===eu)throw new Error(a.data.message);return a},pg=async e=>{const t=await ze(e).get("signup/admin");if(t.data.status===Or)throw new Error(t.data.message);return t.data},mg=async(e,t)=>{const a=await ze(t).get(`invitations/token/${e}`);if(a.data.status===Or)throw new Error(a.data.message);return a.data},du=async e=>{let t="me";Ge?.user?.features?.authProvider==="laravel-passport"&&(t=Zm);const a=await ze(e).get(t,{withCredentials:!0});if("error"in a.data)throw new Error(a.data.message);return a},gg=async(e,t)=>{try{const a=await ze(t).post("signup/admin",e,{withCredentials:!0});if(a.data.status==="EMAIL_ALREADY_EXISTS_ERROR")throw new Error(a.data.message);return a.data?.user}catch{throw new Error("SOMETHING_WRONG")}},hg=async(e,t)=>{let a="me";Ge?.user?.features?.authProvider==="laravel-passport"&&(a=eg);try{const n=await ze(t).put(a,e,{withCredentials:!0});if("error"in n.data)throw new Error("SOMETHING_WRONG");return n}catch{throw new Error("SOMETHING_WRONG")}},Jl="user",Ne=bt.defineStore("user",()=>{const e=r.ref(),t=r.ref(),a=r.ref(void 0),n=r.ref(localStorage.getItem("accessToken")||null),o=r.ref(localStorage.getItem("refreshToken")||null),l=async(I,N,T)=>await ug(I,N,T),s=async(I,N)=>await dg(I,N),u=async(I,N)=>{const T=xt();if("doChangeEmail"in T)return await T.doChangeEmail(I,N);throw new Error("Change email is not supported for the selected auth provider")},i=async(I,N)=>{const T=xt();if("doChangePassword"in T)return await T.doChangePassword(I,N);throw new Error("Change password is not supported for the selected auth provider")},d=async(I,N)=>await cg(I,N),f=async(I,N)=>await fg(I,N),c=async(I,N)=>{const T=xt();if("doSocialSignIn"in T&&typeof T.doSocialSignIn=="function")return await T.doSocialSignIn(I,N);throw new Error(`${I} signin is not supported for the selected auth provider`)},p=async I=>await pg(I),m=async(I,N)=>await mg(I,N),y=()=>{if(a.value)return a.value;const I=localStorage.getItem(Jl);return I?JSON.parse(I):void 0},h=async()=>{const N=await xt().doGetVerificationStatus();return t.value=!!N,N},g=async()=>{const I=xt();return"isLoggedIn"in I?await I.isLoggedIn():!!a.value},b=async I=>await xt().doLogin(I),w=async()=>{await xt().doLogout().then(()=>{k(),a.value=void 0,document.cookie="sFrontToken=; Max-Age=0; path=/; domain="+location.hostname})},v=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("refreshToken")},k=()=>{localStorage.removeItem(Jl)},C=async I=>{const N=xt();if("doRequestPasswordReset"in N)return N.doRequestPasswordReset(I);throw new Error("Request password reset is not supported for the selected auth provider")},A=async I=>{const N=xt();if("doResetPassword"in N)return N.doResetPassword(I);throw new Error("Reset password is not supported for the selected auth provider")},E=async()=>{const I=xt();if("doSendVerificationEmail"in I)return I.doSendVerificationEmail();throw new Error("Send verification email is not supported for the selected auth provider")},P=I=>{e.value=I},$=async I=>{const N=xt();a.value=I,a.value&&("isProfileCompleted"in N&&(a.value.isProfileCompleted=await N.isProfileCompleted()),localStorage.setItem(Jl,JSON.stringify(a.value)))};return{accessToken:n,acceptInvitation:l,addInvitation:s,changeEmail:u,changePassword:i,disableUser:d,enableUser:f,getIsFirstUser:p,getInvitationByToken:m,getUser:y,getVerificationStatus:h,isLoggedIn:g,isEmailVerified:t,invitation:e,login:b,logout:w,refreshToken:o,removeAuthTokens:v,removeUser:k,resetPassword:A,requestPasswordReset:C,sendVerificationEmail:E,setAuthTokens:I=>{n.value=I.accessToken,o.value=I.refreshToken,localStorage.setItem("accessToken",I.accessToken),localStorage.setItem("refreshToken",I.refreshToken)},signUpFirstUser:async(I,N)=>{const T=await gg(I,N);$(T)},setInvitation:P,setUser:$,signup:async I=>{const N=xt();if("doSignup"in N){const T=await N.doSignup(I);$(T)}throw new Error("Signup is not supported for the selected auth provider")},socialSignIn:c,user:a,verifyEmail:async I=>{const N=xt();if("doVerifyEmail"in N)return await N.doVerifyEmail(I||"");throw new Error("Verify email is not supported for the selected auth provider")}}});async function yg(e){const t=Ne(),{logout:a}=t,n=t.getUser();if(n&&n.roles){if(await n.roles.some(l=>typeof l=="string"?e.includes(l):e.includes(l.role)))return!0;await a()}else await a();return!1}const bg=async(e,t,a)=>{let n,o;try{if(o=await ze(t).post(a,e,{withCredentials:!0}),o.status===200)return n=o.data.user,n}catch(l){throw l instanceof jr.AxiosError?l.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},wg=async(e,t)=>{Ne();try{await ze(e).post(t,{withCredentials:!0})}catch(a){throw a instanceof jr.AxiosError?a.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},vg=async(e,t,a)=>{try{return await ze(t).post(a,e,{withCredentials:!0})}catch{throw new Error("SOMETHING_WRONG")}},Sg=async(e,t,a)=>{try{return!!(await ze(t).post(a,e,{withCredentials:!0})).data}catch{throw new Error("SOMETHING_WRONG")}},_g=async(e,t,a)=>{let n,o;try{if(o=await ze(t).post(a,e,{withCredentials:!0}),o.status===201)return n=o.data.user,n}catch(l){throw l instanceof jr.AxiosError?l.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},kg=async(e,t)=>{try{return(await ze(e).get(t)).data?.isVerified}catch{throw new Error("SOMETHING_WRONG")}},Cg=async(e,t)=>{try{return(await ze(e).post(t)).data?Jt.OK:Jt.EMAIL_ALREADY_VERIFIED_ERROR}catch{throw new Error("SOMETHING_WRONG")}},Ag=async(e,t,a)=>{try{return(await ze(t).post(a,{token:e})).data?{status:Jt.OK}:{status:Jt.EMAIL_VERIFICATION_INVALID_TOKEN_ERROR}}catch{throw new Error("SOMETHING_WRONG")}},Rg=async(e,t)=>{try{return(await ze(t).post("/change-email",{email:e},{withCredentials:!0})).data.status}catch(a){if(a.response){const{data:n}=a.response;return{status:n.status,message:n.message}}return{status:"ERROR",message:"Oops! Something went wrong"}}},Mg=async(e,t)=>{let a,n=!1;try{a=await ze(t).post("/change_password",{oldPassword:e.currentPassword,newPassword:e.newPassword},{withCredentials:!0})}catch{throw new Error("SOMETHING_WRONG")}if(a.data.status==="OK")n=!0;else throw a.data.status==="INVALID_PASSWORD"?new Error("INVALID_PASSWORD"):new Error("SOMETHING_WRONG");return n};class Cn{static defaultMaxAgeInSeconds=void 0;static id="profileValidation";constructor(){}getLastFetchedTime(){}getValueFromPayload(t){return t[Cn.id]!==void 0?t[Cn.id].v:void 0}async refresh(){}}async function cu(e){if(await Nr.doesSessionExist()){let t=0;const a=await Nr.validateClaims({overrideGlobalClaimValidators:n=>{const o=e.map(l=>Qi.UserRoleClaim.validators.includes(l));return[...n,...o]}});if(a.length===0)return!0;for(const n of a)n.validatorId===Qi.UserRoleClaim.id&&(t+=1);if(t<e.length)return!0;{const n=Ne(),{logout:o}=n;await o()}}return!1}const xg=async()=>{const e=await Nr.getClaimValue({claim:new Cn});if(e)return e.isVerified?!0:e.gracePeriodEndsAt?e.gracePeriodEndsAt>=Date.now():!1},Eg=async e=>{let t,a;const n={formFields:[{id:"email",value:e.email},{id:"password",value:e.password}]};try{a=await Tr.emailPasswordSignIn(n)}catch(o){throw o?.status===401?new Error("401"):new Error("SOMETHING_WRONG")}if(a.status==="OK")return t=a.user,t;throw a.status==="WRONG_CREDENTIALS_ERROR"?new Error("401"):new Error("SOMETHING_WRONG")},Ig=async()=>{await Nr.signOut()},Pg=async e=>(await Tr.sendPasswordResetEmail({formFields:[{id:"email",value:e.email}]})).status=="OK",$g=async()=>(await kn.sendVerificationEmail()).status,Bg=async e=>{const t=await Tr.submitNewPassword({formFields:[{id:"password",value:e.password}]});if(t.status==="OK")return!0;throw t.status==="RESET_PASSWORD_INVALID_TOKEN_ERROR"?new Error("INVALID_TOKEN"):new Error("SOMETHING_WRONG")},Dg=async e=>{let t,a;const n={formFields:[{id:"email",value:e.email},{id:"password",value:e.password}]};try{a=await Tr.emailPasswordSignUp(n)}catch{throw new Error("SOMETHING_WRONG")}if(a.status==="OK")return t=a.user,t;throw a.status==="FIELD_ERROR"?new Error("409"):new Error("SOMETHING_WRONG")};async function Ng(e,t){const a=await Tr.getAuthorisationURLWithQueryParamsAndSetState({authorisationURL:t,providerId:e});window.location.assign(a)}const Tg=async()=>(await kn.isEmailVerified()).isVerified,Og=async()=>({status:(await kn.verifyEmail()).status}),Vg=e=>{Ne();const t=[Tr.init(),Nr.init({onHandleEvent:async a=>{(a.action==="UNAUTHORISED"||a.action==="SESSION_EXPIRED")&&await fu()&&Nr.attemptRefreshingSession().catch(n=>Promise.reject(n))}})];e.user?.features?.signUp?.emailVerification&&t.push(kn.init()),Fm.init({appInfo:{apiDomain:e.apiBaseUrl,appName:e.appTitle,apiBasePath:e.authBasePath||lg},recipeList:t})},fu=async()=>{try{if(!await Nr.doesSessionExist()){const{setUser:t}=Ne();return t(void 0),!1}return!0}catch{return!1}};let Ge;const Fg=e=>{Ge=e},Lg=()=>Ge?.user?.features?.authProvider&&["laravel-passport","supertokens"].includes(Ge.user.features.authProvider)?Ge.user.features.authProvider:"supertokens",qg={"laravel-passport":{doChangeEmail:e=>{const t=Ge?.user?.apiRoutes?.changeEmail||Hm;return sg(e,Ge?.apiBaseUrl||"",t)},doChangePassword:e=>{const t=Ge?.user?.apiRoutes?.changePassword||Gm;return ig(e,Ge?.apiBaseUrl||"",t)},doGetVerificationStatus:()=>{const e=Ge?.user?.apiRoutes?.getVerificationStatus||zm;return kg(Ge?.apiBaseUrl||"",e)},doLogin:e=>{const t=Ge?.user?.apiRoutes?.login||Ym;return bg(e,Ge?.apiBaseUrl||"",t)},doLogout:()=>{const e=Ge?.user?.apiRoutes?.logout||Wm;return wg(Ge?.apiBaseUrl||"",e)},doRequestPasswordReset:e=>{const t=Ge?.user?.apiRoutes?.passwordResetRequest||Xm;return vg(e,Ge?.apiBaseUrl||"",t)},doResetPassword:e=>{const t=Ge?.user?.apiRoutes?.passwordResetRequest||Km;return Sg(e,Ge?.apiBaseUrl||"",t)},doSendVerificationEmail:()=>{const e=Ge?.user?.apiRoutes?.sendVerificationEmail||Jm;return Cg(Ge?.apiBaseUrl||"",e)},doSignup:e=>{const t=Ge?.user?.apiRoutes?.signup||Qm;return _g(e,Ge?.apiBaseUrl||"",t)},doVerifyEmail:e=>{const t=Ge?.user?.apiRoutes?.verifyEmail||tg;return Ag(e,Ge?.apiBaseUrl||"",t)},verifySessionRoles:yg},supertokens:{doChangeEmail:Rg,doChangePassword:Mg,doGetVerificationStatus:Tg,doLogin:Eg,doLogout:Ig,doRequestPasswordReset:Pg,doResetPassword:Bg,doSendVerificationEmail:$g,doSignup:Dg,doSocialSignIn:Ng,doVerifyEmail:Og,isLoggedIn:fu,isProfileCompleted:xg,verifySessionRoles:cu}},xt=()=>qg[Lg()];Lm.addAxiosInterceptors(jr);const ze=e=>{const t=jr.create({baseURL:e,headers:{"Content-Type":"application/json",Accept:"application/json"},withCredentials:!0});return t.interceptors.response.use(a=>a,async a=>{const n=a.config,o=Ge?.user?.apiRoutes?.refresh||jm;if(a.response?.status===401&&!n._retry&&!n.url.includes(o)){n._retry=!0;try{if((await t.post(o,{withCredentials:!0})).status===200)return t(n)}catch(l){return Promise.reject(l)}}return Promise.reject(a)}),t},Ug=e=>e?JSON.stringify(e):void 0,Ql={en:{roles:{form:{actions:{cancel:"Cancel",create:"Create",update:"Update"},label:{add:"Add a role",permissions:"Permissions",role:"Role",update:"Update permissions"},messages:{add:{error:"Something went wrong",roleAlreadyExists:"Unable to create role as it already exists",success:"Role created successfully"},invalidRole:"Invalid role",update:{error:"Something went wrong",success:"Role permissions updated successfully"}},placeholder:{permissions:"Select permissions"}},table:{actions:{addRole:"Add",deleteRole:"Delete",updatePermissions:"Update permissions"},columns:{permissions:"Permissions",roles:"Roles"},confirmation:{deleteRole:{header:"Confirm delete",message:"Are you sure you want to delete?"}},emptyMessage:"No results",messages:{delete:{error:"Something went wrong",success:"Role deleted successfully"}}},title:"Roles"},user:{changePassword:{errors:{INVALID_PASSWORD:"The password is invalid. Please check your password and try again.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{confirmPassword:{errors:{required:"Confirm password is required",unmatched:"Passwords must match"},label:"Confirm password"},currentPassword:{errors:{required:"Current password is required",weak:"Current password is required"},label:"Current password",placeholder:"Enter your current password"},newPassword:{errors:{required:"New password is required",weak:"Password must contain at least 8 characters, an uppercase, a lowercase and a number"},label:"New password",placeholder:"Enter your new password"},submit:{label:"Change password"}},messages:{success:"You have changed your password successfully."},title:"Change password"},emailVerification:{button:{label:"Resend"},messages:{resend:{alreadyVerified:"Email is already verified. Please try refreshing the page.",error:"Something went wrong. Please try again",success:"Email resent successfully."},resendEmailInfo:"Not received yet?",verify:{alreadyVerified:"Email is already verified",invalidToken:"The token is invalid",success:"Email verified successfully"},verifyEmail:"We've sent an email to {0} with a link for verification. Please check your inbox.",verifyingEmail:"Verifying email"},title:"Please verify your email address",verifyEmail:"Verifying your email address."},firstUser:{title:"Register first user",login:{messages:{error:"Automatic login failed. Redirecting to login page for manual login"}},signup:{messages:{error:"Error signing up first user",success:"First user added successfully. Automatically logging in ..."}}},invitation:{form:{app:{label:"App",placeholder:"Select a app"},email:{label:"Email",placeholder:"Enter your email"},expiresAfter:{label:"Expires after",placeholder:"Enter days"},expiresAt:{label:"Expires at",placeholder:"Select a date"},role:{label:"Role",placeholder:"Select a role"}},messages:{invite:{error:"Error inviting user.",errorFetchingInvitation:"Invalid token. Please contact your administrator.",invalidInvitation:"Invitation is no longer valid",success:"User invited successfully."}},table:{actions:{delete:"Delete",resend:"Resend",revoke:"Revoke"},confirmation:{header:"Confirmation",delete:{message:"Are you sure you want to delete?"},resend:{message:"Are you sure you want to resend?"},revoke:{message:"Are you sure you want to revoke?"}},defaultColumns:{app:"App",email:"Email",expiresAt:"Expires at",invitedBy:"Invited by",role:"Role",status:"Status"},emptyMessage:"Table is empty",inviteUser:"Invite user",pagination:{pageInputLabel:"Go to",rowsPerPage:"Rows"},placeholder:{app:"Select app",date:"Select date range",role:"Select role",search:"Search",status:"Select status"},status:{accepted:"Accepted",expired:"Expired",pending:"Pending",revoked:"Revoked"}},thisApp:"This app"},loading:"Loading...",login:{errors:{401:"Invalid credentials. Please check your email or password and try again.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{submit:"Log in"},email:{errors:{invalid:"Please provide a valid email address",required:"Your email adress is required"},label:"Your email",placeholder:"john.doe{'@'}example.com"},password:{errors:{invalid:"Your password should be at least 8 characters long",required:"Please provide a password"},label:"Your password",placeholder:"Enter your password"},username:{errors:{invalid:"Please provide a valid username",required:"Your username is required"},label:"Your username",placeholder:"Username"}},instructions:"Enter your credentials to continue.",links:{forgotPassword:"Forgot password",signup:"Sign up"},messages:{error:"No email provided by social login. Please use another form of login.",permissionDenied:"The credentials you input are invalid.",success:"Logged in successfully."},social:{facebook:"Continue with Facebook",google:"Continue with Google"},title:"Log in"},logout:{message:"Logged out successfully."},menu:{signin:"Log in",signup:"Sign up"},messages:{disable:{error:"Error disabling user.",success:"User disabled successfully."},enable:{error:"Error enabling user.",success:"User enabled successfully."}},passwordReset:{errors:{INVALID_TOKEN:"The token is invalid. Please request again for password reset.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{submit:"Reset password"},confirmation:{errors:{match:"The 2 passwords must match"},label:"Confirm password",placeholder:"Confirm your password"},password:{errors:{required:"Please provide a password",weak:"Your password should be at least 8 characters long"},label:"New password",placeholder:"Enter your password"}},messages:{success:"Your password is changed successfully.",wrongPassword:"The password confirmation does not match"},modal:{label:{send:"Send"},placeholder:{selectApp:"Select an app"}},title:"Reset password"},passwordResetAcknowledge:{actions:{resend:"Resend"},label:{notReceived:"Didn't receive the email? ",resendIn:"Resend in {0}"},message:"An email with a link to reset your password was sent to {0}. Follow the instructions in the email to access your account.",title:"Check your email"},passwordResetRequest:{form:{actions:{submit:"Send reset link"},email:{errors:{invalid:"Please supply a valid email address",required:"Your email address is required"},label:"Your email",placeholder:"john.doe{'@'}example.com"}},description:"We will send you an email to reset your password",links:{login:"Back to login"},messages:{success:"Please check your provided email to reset your password."},title:"Forgot password"},profile:{accountInfo:{actions:{update:"Update"},label:"Email",messages:{alreadyExist:"Email already exists.",duplicate:"Email is same as the current one.",disabled:"Update email feature is currently disabled.",email:"Email is required.",emailSent:"A verification link has been sent to your email.",error:"An error occurred while updating the email.",invalid:"Invalid email",success:"Email updated successfully.",verify:"Verify email to complete the email update."},newEmail:"New email",placeholder:"Enter your email",title:"Update email"},errors:{SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{update:"Update"},firstName:{messages:{required:"First name is required."},label:"First name",placeholder:"Enter your first name"},lastName:{messages:{required:"Last name is required."},label:"Last name",placeholder:"Enter your last name"},messages:{error:"Something went wrong. Please try again",success:"Profile updated successfully"},middleName:{label:"Middle name(s)",placeholder:"Enter your middle name(s)"}},tabs:{credentials:"Credentials",profile:"My profile"},title:"Profile",updatePassword:{title:"Update password"}},signup:{errors:{409:"This email already exists. Please sign in instead.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{submit:"Sign up"},confirmation:{errors:{match:"The 2 passwords must match"},label:"Confirm password",placeholder:"Confirm your password"},email:{errors:{invalid:"Please supply a valid email address",required:"Your email address is required"},label:"Your email",placeholder:"john.doe{'@'}example.com"},password:{errors:{required:"Please provide a password",weak:"Your password should be at least 8 characters long"},label:"Your password",placeholder:"Enter your password"},termsAndConditions:"I agree to the {0} as set out by the user agreement",termsLabel:"Terms and conditions",username:{errors:{invalid:"Please provide a valid username",required:"Your username is required"},label:"Your username",placeholder:"Username"}},links:{forgotPassword:"Forgot password",login:"Login"},messages:{success:"Signed up successfully."},title:"Sign up"},table:{actions:{disableUser:"Disable user",enableUser:"Enable user"},confirmation:{disableUser:{message:"Are you sure you want to disable this user?"},enableUser:{message:"Are you sure you want to enable this user?"},header:"Confirmation"},defaultColumns:{email:"Email",name:"Name",roles:"Roles",signedUpAt:"Signed up at",status:"Status"},emptyMessage:"Table is empty",inviteUser:"Invite user",pagination:{pageInputLabel:"Go to",rowsPerPage:"Rows"},role:{admin:"ADMIN",superadmin:"SUPERADMIN",user:"USER"},status:{disabled:"Disabled",enabled:"Enabled"}}}},fr:{roles:{form:{actions:{cancel:"Cancel",create:"Create",update:"Update"},label:{add:"Add a role",permissions:"Permissions",role:"Role",update:"Update permissions"},messages:{add:{error:"Something went wrong",roleAlreadyExists:"Unable to create role as it already exists",success:"Role created successfully"},invalidRole:"Invalid role",update:{error:"Something went wrong",success:"Role permissions updated successfully"}},placeholder:{permissions:"Select permissions"}},table:{actions:{addRole:"Add",deleteRole:"Delete",updatePermissions:"Update permissions"},columns:{permissions:"Permissions",roles:"Roles"},confirmation:{deleteRole:{header:"Confirm delete",message:"Are you sure you want to delete?"}},emptyMessage:"No results",messages:{delete:{error:"Something went wrong",success:"Role deleted successfully"}}},title:"Roles"},user:{changePassword:{errors:{INVALID_PASSWORD:"The password is invalid. Please check your password and try again.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{confirmPassword:{errors:{required:"Confirm password is required",unmatched:"Passwords must match"},label:"Confirm password"},currentPassword:{errors:{required:"Current password is required",weak:"Current password is required"},label:"Current password",placeholder:"Enter your current password"},newPassword:{errors:{required:"New password is required",weak:"Password must contain at least 8 characters, an uppercase, a lowercase and a number"},label:"New password",placeholder:"Enter your new password"},submit:{label:"Change password"}},messages:{success:"You have changed your password successfully."},title:"Change password"},emailVerification:{button:{label:"Resend"},messages:{resend:{alreadyVerified:"Email is already verified. Please try refreshing the page.",error:"Something went wrong. Please try again",success:"Email resent successfully."},resendEmailInfo:"Not received yet?",verify:{alreadyVerified:"Email is already verified",invalidToken:"The token is invalid",success:"Email verified successfully"},verifyEmail:"We've sent an email to {0} with a link for verification. Please check your inbox.",verifyingEmail:"Verifying email"},title:"Please verify your email address",verifyEmail:"Verifying your email address."},firstUser:{title:"Register first user",login:{messages:{error:"Automatic login failed. Redirecting to login page for manual login"}},signup:{messages:{error:"Error signing up first user",success:"First user added successfully. Automatically logging in ..."}}},invitation:{form:{app:{label:"App",placeholder:"Select a app"},email:{label:"Email",placeholder:"Enter your email"},expiresAfter:{label:"Expires after",placeholder:"Enter days"},expiresAt:{label:"Expires at",placeholder:"Select a date"},role:{label:"Role",placeholder:"Select a role"}},messages:{invite:{error:"Error inviting user.",errorFetchingInvitation:"Invalid token. Please contact your administrator.",invalidInvitation:"Invitation is no longer valid",success:"User invited successfully."}},table:{actions:{delete:"Delete",resend:"Resend",revoke:"Revoke"},confirmation:{header:"Confirmation",delete:{message:"Are you sure you want to delete?"},resend:{message:"Are you sure you want to resend?"},revoke:{message:"Are you sure you want to revoke?"}},defaultColumns:{app:"App",email:"Email",expiresAt:"Expires at",invitedBy:"Invited by",role:"Role",status:"Status"},emptyMessage:"Table is empty",inviteUser:"Invite user",pagination:{pageInputLabel:"Go to",rowsPerPage:"Rows"},placeholder:{app:"Select app",date:"Select date range",role:"Select role",search:"Search",status:"Select status"},status:{accepted:"Accepted",expired:"Expired",pending:"Pending",revoked:"Revoked"}},thisApp:"This app"},loading:"Loading...[fr]",login:{errors:{401:"Votre identifiant et/ou mot de passe sont invalides.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{submit:"Connexion"},email:{errors:{invalid:"Veuillez saisir une adresse courriel valide",required:"Veuillez saisir votre adresse courriel"},label:"Votre adresse courriel",placeholder:"john.doe{'@'}example.com"},password:{errors:{invalid:"Your password should be at least 8 characters long[fr]",required:"Veuillez saisir un mot de passe"},label:"Votre mot de passe",placeholder:"Enter your password"}},links:{forgotPassword:"Mot de passe oublié",signup:"Inscription"},messages:{permissionDenied:"The credentials you input are invalid.",error:"No email provided by social login. Please use another form of login.",success:"Vous êtes maintenant connecté(e)"},social:{facebook:"Continue with Facebook",google:"Continue with Google"},title:"Connexion"},logout:{message:"Logged out successfully."},menu:{signin:"Connexion",signup:"Inscription"},messages:{disable:{error:"Error disabling user.",success:"User disabled successfully."},enable:{error:"Error enabling user.",success:"User enabled successfully."}},passwordReset:{errors:{INVALID_TOKEN:"The token is invalid. Please request again for password reset.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{submit:"Reset password (fr)"},confirmation:{errors:{match:"Les 2 mots de passe doivent être identiques"},label:"Confirmation de votre nouveau mot de passe",placeholder:"Confirm your password"},password:{errors:{required:"Veuillez saisir un mot de passe",weak:"Votre mot de passe doit avoir au moins 8 caractères"},label:"Nouveau mot de passe",placeholder:"Enter your password"}},messages:{success:"Votre mot de passe a été mis à jour.",wrongPassword:"The password confirmation doesnot match"},modal:{label:{send:"Send"},placeholder:{selectApp:"Select an app"}},title:"Reset password (fr)"},passwordResetAcknowledge:{actions:{resend:"Resend"},label:{notReceived:"Didn't receive the email? ",resendIn:"Resend in {0}"},message:"An email with a link to reset your password was sent to {0}. Follow the instructions in the email to access your account.",title:"Check your email"},passwordResetRequest:{form:{actions:{submit:"Send reset link (fr)"},email:{errors:{invalid:"Veuillez saisir une adresse courriel valide",required:"Veuillez saisir votre adresse courriel"},label:"Votre adresse courriel",placeholder:"john.doe{'@'}example.com"}},description:"We will send you an email to reset your password",links:{login:"Back to login"},messages:{success:"Please check your provided email to reset your password."},title:"Forgot password (fr)"},profile:{accountInfo:{actions:{update:"Update"},label:"Email",messages:{alreadyExist:"Email already exists.",duplicate:"Email is same as the current one.",disabled:"Update email feature is currently disabled.",email:"Email is required.",emailSent:"A verification link has been sent to your email.",error:"An error occurred while updating the email.",invalid:"Invalid email",success:"Email updated successfully.",verify:"Verify email to complete the email update."},newEmail:"New email",placeholder:"Enter your email",title:"Update email"},errors:{SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{update:"Update"},firstName:{messages:{required:"First name is required."},label:"First name",placeholder:"Enter your first name"},lastName:{messages:{required:"Last name is required."},label:"Last name",placeholder:"Enter your last name"},messages:{error:"Something went wrong. Please try again",success:"Profile updated successfully"},middleName:{label:"Middle name(s)",placeholder:"Enter your middle name(s)"}},tabs:{credentials:"Credentials",profile:"My profile"},title:"Profil",updatePassword:{title:"Update password"}},signup:{errors:{409:"This email already exists. Please sign in instead.",SOMETHING_WRONG:"Something went wrong. Please try again."},form:{actions:{submit:"S'inscrire"},confirmation:{errors:{match:"Les 2 mots de passe doivent être identiques"},label:"Confirmez votre mot de passe",placeholder:"Confirm your password"},email:{errors:{invalid:"Veuillez saisir une adresse email valide",required:"Veuillez saisir votre adresse email"},label:"Votre adresse e-mail",placeholder:"john.doe{'@'}example.com"},password:{errors:{required:"Veuillez saisir un mot de passe",weak:"Votre mot de passe doit avoir au moins 8 caractères"},label:"Votre mot de passe",placeholder:"Enter your password"},termsAndConditions:"I agree to the {0} as set out by the user agreement",termsLabel:"Terms and conditions",username:{errors:{invalid:"Please provide a valid username",required:"Your username is required"},label:"Your username",placeholder:"Username"}},links:{forgotPassword:"Mot de passe oublié",login:"Connexion"},messages:{success:"Signed up successfully."},title:"S'inscrire"},table:{actions:{disableUser:"Disable user",enableUser:"Enable user"},confirmation:{disableUser:{message:"Are you sure you want to disable this user?"},enableUser:{message:"Are you sure you want to enable this user?"},header:"Confirmation"},defaultColumns:{email:"Email",name:"Name",roles:"Roles",signedUpAt:"Signed up at",status:"Status"},emptyMessage:"Table is empty",inviteUser:"Invite user",pagination:{pageInputLabel:"Go to",rowsPerPage:"Rows"},role:{admin:"ADMIN",superadmin:"SUPERADMIN",user:"USER"},status:{disabled:"Disabled",enabled:"Enabled"}}}}},Hg={name:"AuthSocialLoginCallback"},pu=r.defineComponent({...Hg,setup(e){const t=We.useConfig(),a=$e(),{t:n}=xe.useI18n({messages:a}),o=r.ref(!1),l=ut.useRouter(),{setUser:s}=Ne();return r.onMounted(async()=>{o.value=!0;const u=await Tr.thirdPartySignInAndUp({});if(u.status!=="OK"){Pe.emit("notify",{text:n("user.login.errors.SOMETHING_WRONG"),type:"error"}),l.hasRoute("login")&&l.push({name:"login"});return}if(u?.user){const i=t?.user?.supportedRoles;i&&await cu(i)||!i?.length?(s(u.user),l.hasRoute("home")&&l.push({name:"home"})):(Pe.emit("notify",{text:n("user.login.messages.error"),type:"error"}),l.hasRoute("login")&&l.push({name:"login"}))}o.value=!1}),(u,i)=>(r.openBlock(),r.createBlock(r.unref(he.LoadingPage),{loading:o.value},null,8,["loading"]))}});/**
1
+ (function(be,xe){typeof exports=="object"&&typeof module<"u"?xe(exports,require("@prefabs.tech/vue3-i18n"),require("vue"),require("axios"),require("pinia"),require("supertokens-web-js"),require("supertokens-web-js/recipe/emailverification"),require("supertokens-web-js/recipe/session"),require("supertokens-web-js/recipe/thirdpartyemailpassword"),require("supertokens-web-js/recipe/userroles"),require("supertokens-website"),require("@prefabs.tech/vue3-config"),require("@prefabs.tech/vue3-ui"),require("vue-router"),require("zod"),require("vee-validate"),require("@vueuse/core"),require("@prefabs.tech/vue3-layout")):typeof define=="function"&&define.amd?define(["exports","@prefabs.tech/vue3-i18n","vue","axios","pinia","supertokens-web-js","supertokens-web-js/recipe/emailverification","supertokens-web-js/recipe/session","supertokens-web-js/recipe/thirdpartyemailpassword","supertokens-web-js/recipe/userroles","supertokens-website","@prefabs.tech/vue3-config","@prefabs.tech/vue3-ui","vue-router","zod","vee-validate","@vueuse/core","@prefabs.tech/vue3-layout"],xe):(be=typeof globalThis<"u"?globalThis:be||self,xe(be.PrefabsTechVue3User={},be.PrefabsTechVue3I18n,be.Vue,be.Axios,be.Pinia,be.SupertokensWebJs,be.SupertokensWebJsRecipeEmailverification,be.SupertokensWebJsRecipeSession,be.SupertokensWebJsRecipeThirdpartyemailpassword,be.SupertokensWebJsRecipeUserroles,be.SupertokensWebsite,be.PrefabsTechVue3Config,be.PrefabsTechVue3UI,be.VueRouter,be.Zod,be.Veevalidate,be.VueuseCore,be.PrefabsTechVue3Layout))})(this,function(be,xe,r,jr,bt,Fm,kn,Nr,Tr,Qi,Lm,We,he,ut,Ue,dt,qm,Jr){"use strict";function Um(e){return{all:e=e||new Map,on:function(t,a){var n=e.get(t);n?n.push(a):e.set(t,[a])},off:function(t,a){var n=e.get(t);n&&(a?n.splice(n.indexOf(a)>>>0,1):e.set(t,[]))},emit:function(t,a){var n=e.get(t);n&&n.slice().map(function(o){o(a)}),(n=e.get("*"))&&n.slice().map(function(o){o(t,a)})}}}const Hm="/api/user/change-email-username",Gm="/api/user/change-password",zm="/api/email/verification-status",Ym="/api/login",Wm="/api/logout",Zm="/api/me",Km="/api/reset-password",Xm="/api/reset-password-request",jm="/api/login/refresh",Jm="/api/email/send-verification",Qm="/api/signup",eg="/api/profile",tg="/api/email/verify",rg="/auth/callback/facebook",ag="/auth/callback/google";var Jt=(e=>(e.EMAIL_ALREADY_VERIFIED="EMAIL_ALREADY_VERIFIED",e.EMAIL_ALREADY_VERIFIED_ERROR="EMAIL_ALREADY_VERIFIED_ERROR",e.EMAIL_VERIFICATION_INVALID_TOKEN_ERROR="EMAIL_VERIFICATION_INVALID_TOKEN_ERROR",e.ERROR="ERROR",e.OK="OK",e))(Jt||{});const eu=404,ng="ROLE_ALREADY_EXISTS",og=401,tu="accepted",ru="expired",au="pending",nu="revoked",jl="username",Qr="ADMIN",ou="SUPERADMIN",lu="USER",su="facebook",iu="google",Or="ERROR",uu="OK",lg="/auth",sg=async(e,t,a)=>{try{return(await ze(t).put(a,{email:e},{withCredentials:!0})).statusText}catch(n){if(n.response){const{data:o}=n.response;return{status:o.status,message:o.message}}return{status:"ERROR",message:"Oops! Something went wrong"}}},ig=async(e,t,a)=>{let n,o;try{if(o=await ze(t).put(a,e,{withCredentials:!0}),o.status===200)return n=o.data,n}catch(l){throw l instanceof jr.AxiosError?l.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},ug=async(e,t,a)=>{const n=await ze(a).post(`invitations/token/${e}`,t,{withCredentials:!0});if(n.data.status===Or)throw new Error(n.data.message);return n.data},dg=async(e,t)=>{const a=await ze(t).post("/invitations",e,{withCredentials:!0});if(a.data.status===Or)throw new Error(a.data.message);return a.data},cg=async(e,t)=>{const a=await ze(t).put(`users/${e}/disable`,{},{withCredentials:!0});if(a.status===eu)throw new Error(a.data.message);return a},fg=async(e,t)=>{const a=await ze(t).put(`users/${e}/enable`,{},{withCredentials:!0});if(a.status===eu)throw new Error(a.data.message);return a},pg=async e=>{const t=await ze(e).get("signup/admin");if(t.data.status===Or)throw new Error(t.data.message);return t.data},mg=async(e,t)=>{const a=await ze(t).get(`invitations/token/${e}`);if(a.data.status===Or)throw new Error(a.data.message);return a.data},du=async e=>{let t="me";Ge?.user?.features?.authProvider==="laravel-passport"&&(t=Zm);const a=await ze(e).get(t,{withCredentials:!0});if("error"in a.data)throw new Error(a.data.message);return a},gg=async(e,t)=>{try{const a=await ze(t).post("signup/admin",e,{withCredentials:!0});if(a.data.status==="EMAIL_ALREADY_EXISTS_ERROR")throw new Error(a.data.message);return a.data?.user}catch{throw new Error("SOMETHING_WRONG")}},hg=async(e,t)=>{let a="me";Ge?.user?.features?.authProvider==="laravel-passport"&&(a=eg);try{const n=await ze(t).put(a,e,{withCredentials:!0});if("error"in n.data)throw new Error("SOMETHING_WRONG");return n}catch{throw new Error("SOMETHING_WRONG")}},Jl="user",Ne=bt.defineStore("user",()=>{const e=r.ref(),t=r.ref(),a=r.ref(void 0),n=r.ref(localStorage.getItem("accessToken")||null),o=r.ref(localStorage.getItem("refreshToken")||null),l=async(I,N,T)=>await ug(I,N,T),s=async(I,N)=>await dg(I,N),u=async(I,N)=>{const T=xt();if("doChangeEmail"in T)return await T.doChangeEmail(I,N);throw new Error("Change email is not supported for the selected auth provider")},i=async(I,N)=>{const T=xt();if("doChangePassword"in T)return await T.doChangePassword(I,N);throw new Error("UNSUPPORTED_AUTH_PROVIDER")},d=async(I,N)=>await cg(I,N),f=async(I,N)=>await fg(I,N),c=async(I,N)=>{const T=xt();if("doSocialSignIn"in T&&typeof T.doSocialSignIn=="function")return await T.doSocialSignIn(I,N);throw new Error(`${I} signin is not supported for the selected auth provider`)},p=async I=>await pg(I),m=async(I,N)=>await mg(I,N),y=()=>{if(a.value)return a.value;const I=localStorage.getItem(Jl);return I?JSON.parse(I):void 0},h=async()=>{const N=await xt().doGetVerificationStatus();return t.value=!!N,N},g=async()=>{const I=xt();return"isLoggedIn"in I?await I.isLoggedIn():!!a.value},b=async I=>await xt().doLogin(I),w=async()=>{await xt().doLogout().then(()=>{k(),a.value=void 0,document.cookie="sFrontToken=; Max-Age=0; path=/; domain="+location.hostname})},v=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("refreshToken")},k=()=>{localStorage.removeItem(Jl)},C=async I=>{const N=xt();if("doRequestPasswordReset"in N)return N.doRequestPasswordReset(I);throw new Error("Request password reset is not supported for the selected auth provider")},A=async I=>{const N=xt();if("doResetPassword"in N)return N.doResetPassword(I);throw new Error("UNSUPPORTED_AUTH_PROVIDER")},E=async()=>{const I=xt();if("doSendVerificationEmail"in I)return I.doSendVerificationEmail();throw new Error("Send verification email is not supported for the selected auth provider")},P=I=>{e.value=I},$=async I=>{const N=xt();a.value=I,a.value&&("isProfileCompleted"in N&&(a.value.isProfileCompleted=await N.isProfileCompleted()),localStorage.setItem(Jl,JSON.stringify(a.value)))};return{accessToken:n,acceptInvitation:l,addInvitation:s,changeEmail:u,changePassword:i,disableUser:d,enableUser:f,getIsFirstUser:p,getInvitationByToken:m,getUser:y,getVerificationStatus:h,isLoggedIn:g,isEmailVerified:t,invitation:e,login:b,logout:w,refreshToken:o,removeAuthTokens:v,removeUser:k,resetPassword:A,requestPasswordReset:C,sendVerificationEmail:E,setAuthTokens:I=>{n.value=I.accessToken,o.value=I.refreshToken,localStorage.setItem("accessToken",I.accessToken),localStorage.setItem("refreshToken",I.refreshToken)},signUpFirstUser:async(I,N)=>{const T=await gg(I,N);$(T)},setInvitation:P,setUser:$,signup:async I=>{const N=xt();if("doSignup"in N){const T=await N.doSignup(I);$(T);return}throw new Error("UNSUPPORTED_AUTH_PROVIDER")},socialSignIn:c,user:a,verifyEmail:async I=>{const N=xt();if("doVerifyEmail"in N)return await N.doVerifyEmail(I||"");throw new Error("Verify email is not supported for the selected auth provider")}}});async function yg(e){const t=Ne(),{logout:a}=t,n=t.getUser();if(n&&n.roles){if(await n.roles.some(l=>typeof l=="string"?e.includes(l):e.includes(l.role)))return!0;await a()}else await a();return!1}const bg=async(e,t,a)=>{let n,o;try{if(o=await ze(t).post(a,e,{withCredentials:!0}),o.status===200)return n=o.data.user,n}catch(l){throw l instanceof jr.AxiosError?l.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},wg=async(e,t)=>{Ne();try{await ze(e).post(t,{withCredentials:!0})}catch(a){throw a instanceof jr.AxiosError?a.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},vg=async(e,t,a)=>{try{return await ze(t).post(a,e,{withCredentials:!0})}catch{throw new Error("SOMETHING_WRONG")}},Sg=async(e,t,a)=>{try{return!!(await ze(t).post(a,e,{withCredentials:!0})).data}catch{throw new Error("SOMETHING_WRONG")}},_g=async(e,t,a)=>{let n,o;try{if(o=await ze(t).post(a,e,{withCredentials:!0}),o.status===201)return n=o.data.user,n}catch(l){throw l instanceof jr.AxiosError?l.response?.status===401?new Error("401"):new Error("SOMETHING_WRONG"):new Error("SOMETHING_WRONG")}},kg=async(e,t)=>{try{return(await ze(e).get(t)).data?.isVerified}catch{throw new Error("SOMETHING_WRONG")}},Cg=async(e,t)=>{try{return(await ze(e).post(t)).data?Jt.OK:Jt.EMAIL_ALREADY_VERIFIED_ERROR}catch{throw new Error("SOMETHING_WRONG")}},Ag=async(e,t,a)=>{try{return(await ze(t).post(a,{token:e})).data?{status:Jt.OK}:{status:Jt.EMAIL_VERIFICATION_INVALID_TOKEN_ERROR}}catch{throw new Error("SOMETHING_WRONG")}},Rg=async(e,t)=>{try{return(await ze(t).post("/change-email",{email:e},{withCredentials:!0})).data.status}catch(a){if(a.response){const{data:n}=a.response;return{status:n.status,message:n.message}}return{status:"ERROR",message:"Oops! Something went wrong"}}},Mg=async(e,t)=>{let a,n=!1;try{a=await ze(t).post("/change_password",{oldPassword:e.currentPassword,newPassword:e.newPassword},{withCredentials:!0})}catch{throw new Error("SOMETHING_WRONG")}if(a.data.status==="OK")n=!0;else throw a.data.status==="INVALID_PASSWORD"?new Error("INVALID_PASSWORD"):new Error("SOMETHING_WRONG");return n};class Cn{static defaultMaxAgeInSeconds=void 0;static id="profileValidation";constructor(){}getLastFetchedTime(){}getValueFromPayload(t){return t[Cn.id]!==void 0?t[Cn.id].v:void 0}async refresh(){}}async function cu(e){if(await Nr.doesSessionExist()){let t=0;const a=await Nr.validateClaims({overrideGlobalClaimValidators:n=>{const o=e.map(l=>Qi.UserRoleClaim.validators.includes(l));return[...n,...o]}});if(a.length===0)return!0;for(const n of a)n.validatorId===Qi.UserRoleClaim.id&&(t+=1);if(t<e.length)return!0;{const n=Ne(),{logout:o}=n;await o()}}return!1}const xg=async()=>{const e=await Nr.getClaimValue({claim:new Cn});if(e)return e.isVerified?!0:e.gracePeriodEndsAt?e.gracePeriodEndsAt>=Date.now():!1},Eg=async e=>{let t,a;const n={formFields:[{id:"email",value:e.email},{id:"password",value:e.password}]};try{a=await Tr.emailPasswordSignIn(n)}catch(o){throw o?.status===401?new Error("401"):new Error("SOMETHING_WRONG")}if(a.status==="OK")return t=a.user,t;throw a.status==="WRONG_CREDENTIALS_ERROR"?new Error("401"):new Error("SOMETHING_WRONG")},Ig=async()=>{await Nr.signOut()},Pg=async e=>(await Tr.sendPasswordResetEmail({formFields:[{id:"email",value:e.email}]})).status=="OK",$g=async()=>(await kn.sendVerificationEmail()).status,Bg=async e=>{const t=await Tr.submitNewPassword({formFields:[{id:"password",value:e.password}]});if(t.status==="OK")return!0;throw t.status==="RESET_PASSWORD_INVALID_TOKEN_ERROR"?new Error("INVALID_TOKEN"):new Error("SOMETHING_WRONG")},Dg=async e=>{let t,a;const n={formFields:[{id:"email",value:e.email},{id:"password",value:e.password}]};try{a=await Tr.emailPasswordSignUp(n)}catch{throw new Error("SOMETHING_WRONG")}if(a.status==="OK")return t=a.user,t;throw a.status==="FIELD_ERROR"?new Error("409"):new Error("SOMETHING_WRONG")};async function Ng(e,t){const a=await Tr.getAuthorisationURLWithQueryParamsAndSetState({authorisationURL:t,providerId:e});window.location.assign(a)}const Tg=async()=>(await kn.isEmailVerified()).isVerified,Og=async()=>({status:(await kn.verifyEmail()).status}),Vg=e=>{Ne();const t=[Tr.init(),Nr.init({onHandleEvent:async a=>{(a.action==="UNAUTHORISED"||a.action==="SESSION_EXPIRED")&&await fu()&&Nr.attemptRefreshingSession().catch(n=>Promise.reject(n))}})];e.user?.features?.signUp?.emailVerification&&t.push(kn.init()),Fm.init({appInfo:{apiDomain:e.apiBaseUrl,appName:e.appTitle,apiBasePath:e.authBasePath||lg},recipeList:t})},fu=async()=>{try{if(!await Nr.doesSessionExist()){const{setUser:t}=Ne();return t(void 0),!1}return!0}catch{return!1}};let Ge;const Fg=e=>{Ge=e},Lg=()=>Ge?.user?.features?.authProvider&&["laravel-passport","supertokens"].includes(Ge.user.features.authProvider)?Ge.user.features.authProvider:"supertokens",qg={"laravel-passport":{doChangeEmail:e=>{const t=Ge?.user?.apiRoutes?.changeEmail||Hm;return sg(e,Ge?.apiBaseUrl||"",t)},doChangePassword:e=>{const t=Ge?.user?.apiRoutes?.changePassword||Gm;return ig(e,Ge?.apiBaseUrl||"",t)},doGetVerificationStatus:()=>{const e=Ge?.user?.apiRoutes?.getVerificationStatus||zm;return kg(Ge?.apiBaseUrl||"",e)},doLogin:e=>{const t=Ge?.user?.apiRoutes?.login||Ym;return bg(e,Ge?.apiBaseUrl||"",t)},doLogout:()=>{const e=Ge?.user?.apiRoutes?.logout||Wm;return wg(Ge?.apiBaseUrl||"",e)},doRequestPasswordReset:e=>{const t=Ge?.user?.apiRoutes?.passwordResetRequest||Xm;return vg(e,Ge?.apiBaseUrl||"",t)},doResetPassword:e=>{const t=Ge?.user?.apiRoutes?.passwordResetRequest||Km;return Sg(e,Ge?.apiBaseUrl||"",t)},doSendVerificationEmail:()=>{const e=Ge?.user?.apiRoutes?.sendVerificationEmail||Jm;return Cg(Ge?.apiBaseUrl||"",e)},doSignup:e=>{const t=Ge?.user?.apiRoutes?.signup||Qm;return _g(e,Ge?.apiBaseUrl||"",t)},doVerifyEmail:e=>{const t=Ge?.user?.apiRoutes?.verifyEmail||tg;return Ag(e,Ge?.apiBaseUrl||"",t)},verifySessionRoles:yg},supertokens:{doChangeEmail:Rg,doChangePassword:Mg,doGetVerificationStatus:Tg,doLogin:Eg,doLogout:Ig,doRequestPasswordReset:Pg,doResetPassword:Bg,doSendVerificationEmail:$g,doSignup:Dg,doSocialSignIn:Ng,doVerifyEmail:Og,isLoggedIn:fu,isProfileCompleted:xg,verifySessionRoles:cu}},xt=()=>qg[Lg()];Lm.addAxiosInterceptors(jr);const ze=e=>{const t=jr.create({baseURL:e,headers:{"Content-Type":"application/json",Accept:"application/json"},withCredentials:!0});return t.interceptors.response.use(a=>a,async a=>{const n=a.config,o=Ge?.user?.apiRoutes?.refresh||jm;if(a.response?.status===401&&!n._retry&&!n.url.includes(o)){n._retry=!0;try{if((await t.post(o,{withCredentials:!0})).status===200)return t(n)}catch(l){return Promise.reject(l)}}return Promise.reject(a)}),t},Ug=e=>e?JSON.stringify(e):void 0,Ql={en:JSON.parse(`{"roles":{"form":{"actions":{"cancel":"Cancel","create":"Create","update":"Update"},"label":{"add":"Add a role","permissions":"Permissions","role":"Role","update":"Update permissions"},"messages":{"add":{"error":"Something went wrong","roleAlreadyExists":"Unable to create role as it already exists","success":"Role created successfully"},"invalidRole":"Invalid role","update":{"error":"Something went wrong","success":"Role permissions updated successfully"}},"placeholder":{"permissions":"Select permissions"}},"table":{"actions":{"addRole":"Add","deleteRole":"Delete","updatePermissions":"Update permissions"},"columns":{"permissions":"Permissions","roles":"Roles"},"confirmation":{"deleteRole":{"header":"Confirm delete","message":"Are you sure you want to delete?"}},"emptyMessage":"No results","messages":{"delete":{"error":"Something went wrong","success":"Role deleted successfully"}}},"title":"Roles"},"user":{"changePassword":{"errors":{"INVALID_PASSWORD":"The password is invalid. Please check your password and try again.","SOMETHING_WRONG":"Something went wrong. Please try again.","UNSUPPORTED_AUTH_PROVIDER":"Change password is not supported for the selected auth provider"},"form":{"confirmPassword":{"errors":{"required":"Confirm password is required","unmatched":"Passwords must match"},"label":"Confirm password"},"currentPassword":{"errors":{"required":"Current password is required","weak":"Current password is required"},"label":"Current password","placeholder":"Enter your current password"},"newPassword":{"errors":{"required":"New password is required","weak":"Password must contain at least 8 characters, an uppercase, a lowercase and a number"},"label":"New password","placeholder":"Enter your new password"},"submit":{"label":"Change password"}},"messages":{"success":"You have changed your password successfully."},"title":"Change password"},"emailVerification":{"button":{"label":"Resend"},"messages":{"resend":{"alreadyVerified":"Email is already verified. Please try refreshing the page.","error":"Something went wrong. Please try again","success":"Email resent successfully."},"resendEmailInfo":"Not received yet?","verify":{"alreadyVerified":"Email is already verified","invalidToken":"The token is invalid","success":"Email verified successfully"},"verifyEmail":"We've sent an email to {0} with a link for verification. Please check your inbox.","verifyingEmail":"Verifying email"},"title":"Please verify your email address","verifyEmail":"Verifying your email address."},"firstUser":{"title":"Register first user","login":{"messages":{"error":"Automatic login failed. Redirecting to login page for manual login"}},"signup":{"messages":{"error":"Error signing up first user","success":"First user added successfully. Automatically logging in ..."}}},"invitation":{"form":{"app":{"label":"App","placeholder":"Select a app"},"email":{"label":"Email","placeholder":"Enter your email"},"expiresAfter":{"label":"Expires after","placeholder":"Enter days"},"expiresAt":{"label":"Expires at","placeholder":"Select a date"},"role":{"label":"Role","placeholder":"Select a role"}},"messages":{"invite":{"error":"Error inviting user.","errorFetchingInvitation":"Invalid token. Please contact your administrator.","invalidInvitation":"Invitation is no longer valid","success":"User invited successfully."}},"table":{"actions":{"delete":"Delete","resend":"Resend","revoke":"Revoke"},"confirmation":{"header":"Confirmation","delete":{"message":"Are you sure you want to delete?"},"resend":{"message":"Are you sure you want to resend?"},"revoke":{"message":"Are you sure you want to revoke?"}},"defaultColumns":{"app":"App","email":"Email","expiresAt":"Expires at","invitedBy":"Invited by","role":"Role","status":"Status"},"emptyMessage":"Table is empty","inviteUser":"Invite user","pagination":{"pageInputLabel":"Go to","rowsPerPage":"Rows"},"placeholder":{"app":"Select app","date":"Select date range","role":"Select role","search":"Search","status":"Select status"},"status":{"accepted":"Accepted","expired":"Expired","pending":"Pending","revoked":"Revoked"}},"thisApp":"This app"},"loading":"Loading...","login":{"errors":{"401":"Invalid credentials. Please check your email or password and try again.","SOMETHING_WRONG":"Something went wrong. Please try again."},"form":{"actions":{"submit":"Log in"},"email":{"errors":{"invalid":"Please provide a valid email address","required":"Your email adress is required"},"label":"Your email","placeholder":"john.doe{'@'}example.com"},"password":{"errors":{"invalid":"Your password should be at least 8 characters long","required":"Please provide a password"},"label":"Your password","placeholder":"Enter your password"},"username":{"errors":{"invalid":"Please provide a valid username","required":"Your username is required"},"label":"Your username","placeholder":"Username"}},"instructions":"Enter your credentials to continue.","links":{"forgotPassword":"Forgot password","signup":"Sign up"},"messages":{"error":"No email provided by social login. Please use another form of login.","permissionDenied":"The credentials you input are invalid.","success":"Logged in successfully."},"social":{"facebook":"Continue with Facebook","google":"Continue with Google"},"title":"Log in"},"logout":{"message":"Logged out successfully."},"menu":{"signin":"Log in","signup":"Sign up"},"messages":{"disable":{"error":"Error disabling user.","success":"User disabled successfully."},"enable":{"error":"Error enabling user.","success":"User enabled successfully."}},"passwordReset":{"errors":{"INVALID_TOKEN":"The token is invalid. Please request again for password reset.","SOMETHING_WRONG":"Something went wrong. Please try again.","UNSUPPORTED_AUTH_PROVIDER":"Reset password is not supported for the selected auth provider"},"form":{"actions":{"submit":"Reset password"},"confirmation":{"errors":{"match":"The 2 passwords must match"},"label":"Confirm password","placeholder":"Confirm your password"},"password":{"errors":{"required":"Please provide a password","weak":"Your password should be at least 8 characters long"},"label":"New password","placeholder":"Enter your password"}},"messages":{"success":"Your password is changed successfully.","wrongPassword":"The password confirmation does not match"},"modal":{"label":{"send":"Send"},"placeholder":{"selectApp":"Select an app"}},"title":"Reset password"},"passwordResetAcknowledge":{"actions":{"resend":"Resend"},"label":{"notReceived":"Didn't receive the email? ","resendIn":"Resend in {0}"},"message":"An email with a link to reset your password was sent to {0}. Follow the instructions in the email to access your account.","title":"Check your email"},"passwordResetRequest":{"form":{"actions":{"submit":"Send reset link"},"email":{"errors":{"invalid":"Please supply a valid email address","required":"Your email address is required"},"label":"Your email","placeholder":"john.doe{'@'}example.com"}},"description":"We will send you an email to reset your password","links":{"login":"Back to login"},"messages":{"success":"Please check your provided email to reset your password."},"title":"Forgot password"},"profile":{"accountInfo":{"actions":{"update":"Update"},"label":"Email","messages":{"alreadyExist":"Email already exists.","duplicate":"Email is same as the current one.","disabled":"Update email feature is currently disabled.","email":"Email is required.","emailSent":"A verification link has been sent to your email.","error":"An error occurred while updating the email.","invalid":"Invalid email","success":"Email updated successfully.","verify":"Verify email to complete the email update."},"newEmail":"New email","placeholder":"Enter your email","title":"Update email"},"errors":{"SOMETHING_WRONG":"Something went wrong. Please try again."},"form":{"actions":{"update":"Update"},"firstName":{"messages":{"required":"First name is required."},"label":"First name","placeholder":"Enter your first name"},"lastName":{"messages":{"required":"Last name is required."},"label":"Last name","placeholder":"Enter your last name"},"messages":{"error":"Something went wrong. Please try again","success":"Profile updated successfully"},"middleName":{"label":"Middle name(s)","placeholder":"Enter your middle name(s)"}},"tabs":{"credentials":"Credentials","profile":"My profile"},"title":"Profile","updatePassword":{"title":"Update password"}},"signup":{"errors":{"409":"This email already exists. Please sign in instead.","SOMETHING_WRONG":"Something went wrong. Please try again.","UNSUPPORTED_AUTH_PROVIDER":"Signup is not supported for the selected auth provider"},"form":{"actions":{"submit":"Sign up"},"confirmation":{"errors":{"match":"The 2 passwords must match"},"label":"Confirm password","placeholder":"Confirm your password"},"email":{"errors":{"invalid":"Please supply a valid email address","required":"Your email address is required"},"label":"Your email","placeholder":"john.doe{'@'}example.com"},"password":{"errors":{"required":"Please provide a password","weak":"Your password should be at least 8 characters long"},"label":"Your password","placeholder":"Enter your password"},"termsAndConditions":"I agree to the {0} as set out by the user agreement","termsLabel":"Terms and conditions","username":{"errors":{"invalid":"Please provide a valid username","required":"Your username is required"},"label":"Your username","placeholder":"Username"}},"links":{"forgotPassword":"Forgot password","login":"Login"},"messages":{"success":"Signed up successfully."},"title":"Sign up"},"table":{"actions":{"disableUser":"Disable user","enableUser":"Enable user"},"confirmation":{"disableUser":{"message":"Are you sure you want to disable this user?"},"enableUser":{"message":"Are you sure you want to enable this user?"},"header":"Confirmation"},"defaultColumns":{"email":"Email","name":"Name","roles":"Roles","signedUpAt":"Signed up at","status":"Status"},"emptyMessage":"Table is empty","inviteUser":"Invite user","pagination":{"pageInputLabel":"Go to","rowsPerPage":"Rows"},"role":{"admin":"ADMIN","superadmin":"SUPERADMIN","user":"USER"},"status":{"disabled":"Disabled","enabled":"Enabled"}}}}`),fr:JSON.parse(`{"roles":{"form":{"actions":{"cancel":"Cancel","create":"Create","update":"Update"},"label":{"add":"Add a role","permissions":"Permissions","role":"Role","update":"Update permissions"},"messages":{"add":{"error":"Something went wrong","roleAlreadyExists":"Unable to create role as it already exists","success":"Role created successfully"},"invalidRole":"Invalid role","update":{"error":"Something went wrong","success":"Role permissions updated successfully"}},"placeholder":{"permissions":"Select permissions"}},"table":{"actions":{"addRole":"Add","deleteRole":"Delete","updatePermissions":"Update permissions"},"columns":{"permissions":"Permissions","roles":"Roles"},"confirmation":{"deleteRole":{"header":"Confirm delete","message":"Are you sure you want to delete?"}},"emptyMessage":"No results","messages":{"delete":{"error":"Something went wrong","success":"Role deleted successfully"}}},"title":"Roles"},"user":{"changePassword":{"errors":{"INVALID_PASSWORD":"The password is invalid. Please check your password and try again.","SOMETHING_WRONG":"Something went wrong. Please try again.","UNSUPPORTED_AUTH_PROVIDER":"Change password is not supported for the selected auth provider"},"form":{"confirmPassword":{"errors":{"required":"Confirm password is required","unmatched":"Passwords must match"},"label":"Confirm password"},"currentPassword":{"errors":{"required":"Current password is required","weak":"Current password is required"},"label":"Current password","placeholder":"Enter your current password"},"newPassword":{"errors":{"required":"New password is required","weak":"Password must contain at least 8 characters, an uppercase, a lowercase and a number"},"label":"New password","placeholder":"Enter your new password"},"submit":{"label":"Change password"}},"messages":{"success":"You have changed your password successfully."},"title":"Change password"},"emailVerification":{"button":{"label":"Resend"},"messages":{"resend":{"alreadyVerified":"Email is already verified. Please try refreshing the page.","error":"Something went wrong. Please try again","success":"Email resent successfully."},"resendEmailInfo":"Not received yet?","verify":{"alreadyVerified":"Email is already verified","invalidToken":"The token is invalid","success":"Email verified successfully"},"verifyEmail":"We've sent an email to {0} with a link for verification. Please check your inbox.","verifyingEmail":"Verifying email"},"title":"Please verify your email address","verifyEmail":"Verifying your email address."},"firstUser":{"title":"Register first user","login":{"messages":{"error":"Automatic login failed. Redirecting to login page for manual login"}},"signup":{"messages":{"error":"Error signing up first user","success":"First user added successfully. Automatically logging in ..."}}},"invitation":{"form":{"app":{"label":"App","placeholder":"Select a app"},"email":{"label":"Email","placeholder":"Enter your email"},"expiresAfter":{"label":"Expires after","placeholder":"Enter days"},"expiresAt":{"label":"Expires at","placeholder":"Select a date"},"role":{"label":"Role","placeholder":"Select a role"}},"messages":{"invite":{"error":"Error inviting user.","errorFetchingInvitation":"Invalid token. Please contact your administrator.","invalidInvitation":"Invitation is no longer valid","success":"User invited successfully."}},"table":{"actions":{"delete":"Delete","resend":"Resend","revoke":"Revoke"},"confirmation":{"header":"Confirmation","delete":{"message":"Are you sure you want to delete?"},"resend":{"message":"Are you sure you want to resend?"},"revoke":{"message":"Are you sure you want to revoke?"}},"defaultColumns":{"app":"App","email":"Email","expiresAt":"Expires at","invitedBy":"Invited by","role":"Role","status":"Status"},"emptyMessage":"Table is empty","inviteUser":"Invite user","pagination":{"pageInputLabel":"Go to","rowsPerPage":"Rows"},"placeholder":{"app":"Select app","date":"Select date range","role":"Select role","search":"Search","status":"Select status"},"status":{"accepted":"Accepted","expired":"Expired","pending":"Pending","revoked":"Revoked"}},"thisApp":"This app"},"loading":"Loading...[fr]","login":{"errors":{"401":"Votre identifiant et/ou mot de passe sont invalides.","SOMETHING_WRONG":"Something went wrong. Please try again."},"form":{"actions":{"submit":"Connexion"},"email":{"errors":{"invalid":"Veuillez saisir une adresse courriel valide","required":"Veuillez saisir votre adresse courriel"},"label":"Votre adresse courriel","placeholder":"john.doe{'@'}example.com"},"password":{"errors":{"invalid":"Your password should be at least 8 characters long[fr]","required":"Veuillez saisir un mot de passe"},"label":"Votre mot de passe","placeholder":"Enter your password"}},"links":{"forgotPassword":"Mot de passe oublié","signup":"Inscription"},"messages":{"permissionDenied":"The credentials you input are invalid.","error":"No email provided by social login. Please use another form of login.","success":"Vous êtes maintenant connecté(e)"},"social":{"facebook":"Continue with Facebook","google":"Continue with Google"},"title":"Connexion"},"logout":{"message":"Logged out successfully."},"menu":{"signin":"Connexion","signup":"Inscription"},"messages":{"disable":{"error":"Error disabling user.","success":"User disabled successfully."},"enable":{"error":"Error enabling user.","success":"User enabled successfully."}},"passwordReset":{"errors":{"INVALID_TOKEN":"The token is invalid. Please request again for password reset.","SOMETHING_WRONG":"Something went wrong. Please try again.","UNSUPPORTED_AUTH_PROVIDER":"Reset password is not supported for the selected auth provider"},"form":{"actions":{"submit":"Reset password (fr)"},"confirmation":{"errors":{"match":"Les 2 mots de passe doivent être identiques"},"label":"Confirmation de votre nouveau mot de passe","placeholder":"Confirm your password"},"password":{"errors":{"required":"Veuillez saisir un mot de passe","weak":"Votre mot de passe doit avoir au moins 8 caractères"},"label":"Nouveau mot de passe","placeholder":"Enter your password"}},"messages":{"success":"Votre mot de passe a été mis à jour.","wrongPassword":"The password confirmation doesnot match"},"modal":{"label":{"send":"Send"},"placeholder":{"selectApp":"Select an app"}},"title":"Reset password (fr)"},"passwordResetAcknowledge":{"actions":{"resend":"Resend"},"label":{"notReceived":"Didn't receive the email? ","resendIn":"Resend in {0}"},"message":"An email with a link to reset your password was sent to {0}. Follow the instructions in the email to access your account.","title":"Check your email"},"passwordResetRequest":{"form":{"actions":{"submit":"Send reset link (fr)"},"email":{"errors":{"invalid":"Veuillez saisir une adresse courriel valide","required":"Veuillez saisir votre adresse courriel"},"label":"Votre adresse courriel","placeholder":"john.doe{'@'}example.com"}},"description":"We will send you an email to reset your password","links":{"login":"Back to login"},"messages":{"success":"Please check your provided email to reset your password."},"title":"Forgot password (fr)"},"profile":{"accountInfo":{"actions":{"update":"Update"},"label":"Email","messages":{"alreadyExist":"Email already exists.","duplicate":"Email is same as the current one.","disabled":"Update email feature is currently disabled.","email":"Email is required.","emailSent":"A verification link has been sent to your email.","error":"An error occurred while updating the email.","invalid":"Invalid email","success":"Email updated successfully.","verify":"Verify email to complete the email update."},"newEmail":"New email","placeholder":"Enter your email","title":"Update email"},"errors":{"SOMETHING_WRONG":"Something went wrong. Please try again."},"form":{"actions":{"update":"Update"},"firstName":{"messages":{"required":"First name is required."},"label":"First name","placeholder":"Enter your first name"},"lastName":{"messages":{"required":"Last name is required."},"label":"Last name","placeholder":"Enter your last name"},"messages":{"error":"Something went wrong. Please try again","success":"Profile updated successfully"},"middleName":{"label":"Middle name(s)","placeholder":"Enter your middle name(s)"}},"tabs":{"credentials":"Credentials","profile":"My profile"},"title":"Profil","updatePassword":{"title":"Update password"}},"signup":{"errors":{"409":"This email already exists. Please sign in instead.","SOMETHING_WRONG":"Something went wrong. Please try again.","UNSUPPORTED_AUTH_PROVIDER":"Signup is not supported for the selected auth provider"},"form":{"actions":{"submit":"S'inscrire"},"confirmation":{"errors":{"match":"Les 2 mots de passe doivent être identiques"},"label":"Confirmez votre mot de passe","placeholder":"Confirm your password"},"email":{"errors":{"invalid":"Veuillez saisir une adresse email valide","required":"Veuillez saisir votre adresse email"},"label":"Votre adresse e-mail","placeholder":"john.doe{'@'}example.com"},"password":{"errors":{"required":"Veuillez saisir un mot de passe","weak":"Votre mot de passe doit avoir au moins 8 caractères"},"label":"Votre mot de passe","placeholder":"Enter your password"},"termsAndConditions":"I agree to the {0} as set out by the user agreement","termsLabel":"Terms and conditions","username":{"errors":{"invalid":"Please provide a valid username","required":"Your username is required"},"label":"Your username","placeholder":"Username"}},"links":{"forgotPassword":"Mot de passe oublié","login":"Connexion"},"messages":{"success":"Signed up successfully."},"title":"S'inscrire"},"table":{"actions":{"disableUser":"Disable user","enableUser":"Enable user"},"confirmation":{"disableUser":{"message":"Are you sure you want to disable this user?"},"enableUser":{"message":"Are you sure you want to enable this user?"},"header":"Confirmation"},"defaultColumns":{"email":"Email","name":"Name","roles":"Roles","signedUpAt":"Signed up at","status":"Status"},"emptyMessage":"Table is empty","inviteUser":"Invite user","pagination":{"pageInputLabel":"Go to","rowsPerPage":"Rows"},"role":{"admin":"ADMIN","superadmin":"SUPERADMIN","user":"USER"},"status":{"disabled":"Disabled","enabled":"Enabled"}}}}`)},Hg={name:"AuthSocialLoginCallback"},pu=r.defineComponent({...Hg,setup(e){const t=We.useConfig(),a=$e(),{t:n}=xe.useI18n({messages:a}),o=r.ref(!1),l=ut.useRouter(),{setUser:s}=Ne();return r.onMounted(async()=>{o.value=!0;const u=await Tr.thirdPartySignInAndUp({});if(u.status!=="OK"){Pe.emit("notify",{text:n("user.login.errors.SOMETHING_WRONG"),type:"error"}),l.hasRoute("login")&&l.push({name:"login"});return}if(u?.user){const i=t?.user?.supportedRoles;i&&await cu(i)||!i?.length?(s(u.user),l.hasRoute("home")&&l.push({name:"home"})):(Pe.emit("notify",{text:n("user.login.messages.error"),type:"error"}),l.hasRoute("login")&&l.push({name:"login"}))}o.value=!1}),(u,i)=>(r.openBlock(),r.createBlock(r.unref(he.LoadingPage),{loading:o.value},null,8,["loading"]))}});/**
2
2
  * vee-validate v4.15.0
3
3
  * (c) 2024 Abdelrahman Awad
4
4
  * @license MIT
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,QAAQ,EACT,MAAM,SAAS,CAAC;AAIjB,QAAA,MAAM,YAAY;;8BAQP,MAAM,cACD,gBAAgB,cAChB,MAAM;oCAOF,GAAG,cACP,MAAM;yBAKc,MAAM,cAAc,MAAM;8BAkBjD,qBAAqB,cAClB,MAAM;sBAkBW,MAAM,cAAc,MAAM;qBAI3B,MAAM,cAAc,MAAM;iCAoB1C,MAAM;;;kCAKuB,MAAM,cAAc,MAAM;mBAIjD,QAAQ;;;;;yBA8BM,gBAAgB;;;;;6BA6CvC,oBAAoB,KAC5B,OAAO,CAAC,OAAO,CAAC;oCAfR,2BAA2B,KACnC,OAAO,CAAC,OAAO,CAAC;;gCAyDgB,UAAU;mCAqB9B,gBAAgB,cACjB,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC;oCA1CuB,UAAU,GAAG,SAAS;wBAI5B,QAAQ,GAAG,SAAS;0BAuBlB,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;+BAxJ3B,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6KhC,MAAM;;;;;;;8BAzOhC,MAAM,cACD,gBAAgB,cAChB,MAAM;oCAOF,GAAG,cACP,MAAM;yBAKc,MAAM,cAAc,MAAM;8BAkBjD,qBAAqB,cAClB,MAAM;sBAkBW,MAAM,cAAc,MAAM;qBAI3B,MAAM,cAAc,MAAM;iCAoB1C,MAAM;;;kCAKuB,MAAM,cAAc,MAAM;mBAIjD,QAAQ;;;;;yBA8BM,gBAAgB;;;;;6BA6CvC,oBAAoB,KAC5B,OAAO,CAAC,OAAO,CAAC;oCAfR,2BAA2B,KACnC,OAAO,CAAC,OAAO,CAAC;;gCAyDgB,UAAU;mCAqB9B,gBAAgB,cACjB,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC;oCA1CuB,UAAU,GAAG,SAAS;wBAI5B,QAAQ,GAAG,SAAS;0BAuBlB,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;+BAxJ3B,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6KhC,MAAM;;;;;;;8BAzOhC,MAAM,cACD,gBAAgB,cAChB,MAAM;oCAOF,GAAG,cACP,MAAM;yBAKc,MAAM,cAAc,MAAM;8BAkBjD,qBAAqB,cAClB,MAAM;sBAkBW,MAAM,cAAc,MAAM;qBAI3B,MAAM,cAAc,MAAM;iCAoB1C,MAAM;;;kCAKuB,MAAM,cAAc,MAAM;mBAIjD,QAAQ;;;;;yBA8BM,gBAAgB;;;;;6BA6CvC,oBAAoB,KAC5B,OAAO,CAAC,OAAO,CAAC;oCAfR,2BAA2B,KACnC,OAAO,CAAC,OAAO,CAAC;;gCAyDgB,UAAU;mCAqB9B,gBAAgB,cACjB,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC;oCA1CuB,UAAU,GAAG,SAAS;wBAI5B,QAAQ,GAAG,SAAS;0BAuBlB,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;+BAxJ3B,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6KhC,MAAM;;;;;0bA4CzC,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,QAAQ,EACT,MAAM,SAAS,CAAC;AAIjB,QAAA,MAAM,YAAY;;8BAQP,MAAM,cACD,gBAAgB,cAChB,MAAM;oCAOF,GAAG,cACP,MAAM;yBAKc,MAAM,cAAc,MAAM;8BAkBjD,qBAAqB,cAClB,MAAM;sBAgBW,MAAM,cAAc,MAAM;qBAI3B,MAAM,cAAc,MAAM;iCAoB1C,MAAM;;;kCAKuB,MAAM,cAAc,MAAM;mBAIjD,QAAQ;;;;;yBA8BM,gBAAgB;;;;;6BA6CvC,oBAAoB,KAC5B,OAAO,CAAC,OAAO,CAAC;oCAfR,2BAA2B,KACnC,OAAO,CAAC,OAAO,CAAC;;gCAuDgB,UAAU;mCAuB9B,gBAAgB,cACjB,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC;oCA5CuB,UAAU,GAAG,SAAS;wBAI5B,QAAQ,GAAG,SAAS;0BAuBlB,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;+BAtJ3B,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6KhC,MAAM;;;;;;;8BAvOhC,MAAM,cACD,gBAAgB,cAChB,MAAM;oCAOF,GAAG,cACP,MAAM;yBAKc,MAAM,cAAc,MAAM;8BAkBjD,qBAAqB,cAClB,MAAM;sBAgBW,MAAM,cAAc,MAAM;qBAI3B,MAAM,cAAc,MAAM;iCAoB1C,MAAM;;;kCAKuB,MAAM,cAAc,MAAM;mBAIjD,QAAQ;;;;;yBA8BM,gBAAgB;;;;;6BA6CvC,oBAAoB,KAC5B,OAAO,CAAC,OAAO,CAAC;oCAfR,2BAA2B,KACnC,OAAO,CAAC,OAAO,CAAC;;gCAuDgB,UAAU;mCAuB9B,gBAAgB,cACjB,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC;oCA5CuB,UAAU,GAAG,SAAS;wBAI5B,QAAQ,GAAG,SAAS;0BAuBlB,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;+BAtJ3B,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6KhC,MAAM;;;;;;;8BAvOhC,MAAM,cACD,gBAAgB,cAChB,MAAM;oCAOF,GAAG,cACP,MAAM;yBAKc,MAAM,cAAc,MAAM;8BAkBjD,qBAAqB,cAClB,MAAM;sBAgBW,MAAM,cAAc,MAAM;qBAI3B,MAAM,cAAc,MAAM;iCAoB1C,MAAM;;;kCAKuB,MAAM,cAAc,MAAM;mBAIjD,QAAQ;;;;;yBA8BM,gBAAgB;;;;;6BA6CvC,oBAAoB,KAC5B,OAAO,CAAC,OAAO,CAAC;oCAfR,2BAA2B,KACnC,OAAO,CAAC,OAAO,CAAC;;gCAuDgB,UAAU;mCAuB9B,gBAAgB,cACjB,MAAM,KACjB,OAAO,CAAC,IAAI,CAAC;oCA5CuB,UAAU,GAAG,SAAS;wBAI5B,QAAQ,GAAG,SAAS;0BAuBlB,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAAC;+BAtJ3B,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA6KhC,MAAM;;;;;0bA4CzC,CAAC;AAEH,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prefabs.tech/vue3-user",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Vue3 User Plugin",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,12 +23,12 @@
23
23
  "devDependencies": {
24
24
  "@prefabs.tech/eslint-config": "0.2.0",
25
25
  "@prefabs.tech/tsconfig": "0.2.0",
26
- "@prefabs.tech/vue3-config": "0.28.0",
27
- "@prefabs.tech/vue3-form": "0.28.0",
28
- "@prefabs.tech/vue3-i18n": "0.28.0",
29
- "@prefabs.tech/vue3-layout": "0.28.0",
30
- "@prefabs.tech/vue3-tanstack-table": "0.28.0",
31
- "@prefabs.tech/vue3-ui": "0.28.0",
26
+ "@prefabs.tech/vue3-config": "0.29.0",
27
+ "@prefabs.tech/vue3-form": "0.29.0",
28
+ "@prefabs.tech/vue3-i18n": "0.29.0",
29
+ "@prefabs.tech/vue3-layout": "0.29.0",
30
+ "@prefabs.tech/vue3-tanstack-table": "0.29.0",
31
+ "@prefabs.tech/vue3-ui": "0.29.0",
32
32
  "@iconify/vue": "4.3.0",
33
33
  "@types/node": "24.10.1",
34
34
  "@typescript-eslint/eslint-plugin": "8.24.1",
@@ -64,10 +64,10 @@
64
64
  "zod": "3.24.2"
65
65
  },
66
66
  "peerDependencies": {
67
- "@prefabs.tech/vue3-config": "0.28.0",
68
- "@prefabs.tech/vue3-i18n": "0.28.0",
69
- "@prefabs.tech/vue3-layout": "0.28.0",
70
- "@prefabs.tech/vue3-ui": "0.28.0",
67
+ "@prefabs.tech/vue3-config": "0.29.0",
68
+ "@prefabs.tech/vue3-i18n": "0.29.0",
69
+ "@prefabs.tech/vue3-layout": "0.29.0",
70
+ "@prefabs.tech/vue3-ui": "0.29.0",
71
71
  "@vee-validate/i18n": ">=4.7.1",
72
72
  "@vee-validate/rules": ">=4.7.1",
73
73
  "@vueuse/core": ">=9.4.0",
@@ -88,10 +88,10 @@
88
88
  "lint:fix": "eslint . --ext .vue --fix",
89
89
  "snapshot:update": "vitest --environment jsdom run --update",
90
90
  "sort-package": "npx sort-package-json",
91
- "test": "pnpm build && vitest --environment jsdom run --coverage",
92
- "test:component": "vitest --environment jsdom run component/",
93
- "test:snapshot": "vitest --environment jsdom run snapshot/",
94
- "test:unit": "vitest --environment jsdom run unit/",
91
+ "test": "pnpm build && vitest --environment jsdom run --coverage --passWithNoTests",
92
+ "test:component": "vitest --environment jsdom run component/ --passWithNoTests",
93
+ "test:snapshot": "vitest --environment jsdom run snapshot/ --passWithNoTests",
94
+ "test:unit": "vitest --environment jsdom run unit/ --passWithNoTests",
95
95
  "typecheck": "vue-tsc --noEmit -p tsconfig.json --composite false"
96
96
  }
97
97
  }