@wellesley/auth 1.0.167 → 1.0.168
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.
- package/index.mjs +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{api as Yo,handleBasicResponse as Ht,useGetApiV1SearchQuery as RR,usePutApiV1AccountsResendEmailByHashMutation as AR,usePostApiV1AccountsAddReasonMutation as CR}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.136";import{createSlice as bv}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{getErrorMsg as Mp,getServerApiErrorCode as wn}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.
|
|
1
|
+
import{api as Yo,handleBasicResponse as Ht,useGetApiV1SearchQuery as RR,usePutApiV1AccountsResendEmailByHashMutation as AR,usePostApiV1AccountsAddReasonMutation as CR}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.136";import{createSlice as bv}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{getErrorMsg as Mp,getServerApiErrorCode as wn}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.2";import{toast as vv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{userSlice as oa,UserAvatar as IR}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.102";import*as Xc from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import xv,{forwardRef as zv,createElement as up,useCallback as wr,useEffect as We,useState as Nt,useRef as Br,useMemo as yg}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{useSelector as Ce,useDispatch as Pt}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Button as Bp,cn as Ve,HoverCard as NR,HoverCardTrigger as qR,HoverCardContent as OR,Switch as PR,Tooltip as gg,TooltipTrigger as mg,TooltipContent as kg,Textarea as DR,FormField as LR,FormItem as MR,FormLabel as BR,FormControl as UR,Input as wg,FormMessage as $R,Form as bn,ButtonLoader as qa}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.56";import{useAppsNavigate as Gr,AppsLink as Ra}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.71";import{logErrorToSentry as GR}from"https://cdn.jsdelivr.net/npm/@wellesley/sentry@1.0.9";import{get as fp,set as Qc,appendErrors as FR,useForm as vn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as WR,rootReducer as HR}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.137";import{EmojiPicker as YR,EmojiStyle as VR}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.2";import{useSearchParams as ZR}from"https://cdn.jsdelivr.net/npm/react-router-dom@6.22.2/+esm";import{instanceInfoSlice as dp}from"https://cdn.jsdelivr.net/npm/@wellesley/instanceinfo@1.0.9";const si=()=>"object"!=typeof window,Sv=()=>Tv()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),Ev=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},jv=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),KR=(e,t)=>{const r=si()?"":document.cookie,a=`; ${t||r}`.split(`; ${e}=`);if(2===a.length)return(a.pop()||"").replace("=","").split(";").shift()},JR=(e,t)=>{si()||(document.cookie=jv({[e]:"",path:"/",domain:t||Sv(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},XR=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],Tv=()=>XR.includes(location.hostname),QR=(e,t="",r=10,a)=>{si()||(document.cookie=jv({[e]:t,path:"/",domain:a||Sv(),expires:Ev(r),...!Tv()&&{SameSite:"None",Secure:!0}}))},oi={set:QR,remove:JR,get:KR,getExpireDate:Ev},ii="auth_token",bg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isAuthBlockVisible:!0,isPending:!1,isAuthenticated:!1},je=bv({name:"auth",initialState:bg,reducers:{logout:()=>bg,setNewEmail:(e,t)=>{e.newEmail=t.payload},setForgotPasswordStep:(e,t)=>{e.forgotPasswordStep=t.payload},updateForgotPasswordFields:(e,t)=>{e.forgotPasswordFields={...e.forgotPasswordFields,...t.payload}},resetForgotPasswordFields:e=>{e.forgotPasswordFields=null},setSignupStep:(e,t)=>{e.signupStep=t.payload},updateSignupFields:(e,t)=>{e.signupFields={...e.signupFields,...t.payload}},resetSignupFields:e=>{e.signupFields=null},setPending:(e,t)=>{e.isPending=t.payload},showAuthBlock:(e,t)=>{e.isAuthBlockVisible=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload,e.isPending=!1}},selectors:{selectToken:e=>e.token,selectNewEmail:e=>e.newEmail,selectForgotPasswordStep:e=>e.forgotPasswordStep,selectForgotPasswordFields:e=>e.forgotPasswordFields,selectSignupStep:e=>e.signupStep,selectSignupFields:e=>e.signupFields,selectPending:e=>e.isPending,selectAuthBlockVisible:e=>e.isAuthBlockVisible,selectIsAuthenticated:e=>e.isAuthenticated}}),el=async(e,t,r)=>{try{e(je.actions.setPending(!0));const{data:a}=await t;return oi.set(ii,a.token.sessionKey),null==r||r(),t}catch(t){e(je.actions.setPending(!1)),vv.error(Mp(t))}},eA=Yo.enhanceEndpoints({endpoints:{postApiV1AccountsPasswordRecover:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsPasswordRecoverCheckCode:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsPasswordRecoverChange:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsPasswordChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},putApiV1AccountsPasswordChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsPasswordChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},putApiV1AccountsEmailChangeResendCode:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},putApiV1AccountsResendEmailByHash:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsEmailChangeRequest:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsEmailChangeConfirm:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsConfirmEmail:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsCheckCaptcha:{async onQueryStarted(e,{queryFulfilled:t}){await Ht(t)}},postApiV1AccountsFinishCreating:{async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await el(t,r,(()=>{vv.success("User registered successfully")}))}},postApiV1AccountsAuthenticate:{invalidatesTags:["Secure"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){await el(t,r)}},postApiV1AccountsSignup:{invalidatesTags:["Secure"]},postApiV1AccountsReselectUser:{async onQueryStarted({userId:e},{dispatch:t,queryFulfilled:r}){await el(t,r),e&&t(oa.actions.updateData({selectedUserId:e}))}}}}),{usePostApiV1AccountsPasswordRecoverMutation:Rv,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:Up,usePostApiV1AccountsPasswordRecoverChangeMutation:tA,usePostApiV1AccountsPasswordChangeConfirmMutation:Av,usePostApiV1AccountsPasswordChangeRequestMutation:rA,usePutApiV1AccountsPasswordChangeResendCodeMutation:aA,usePostApiV1AccountsAuthenticateMutation:Cv,usePostApiV1AccountsEmailChangeRequestMutation:nA,usePostApiV1AccountsEmailChangeConfirmMutation:Iv,usePostApiV1AccountsSignupMutation:$p,usePutApiV1AccountsResendEmailByHashMutation:tce,usePutApiV1AccountsEmailChangeResendCodeMutation:sA,usePostApiV1AccountsConfirmEmailMutation:Nv,usePostApiV1AccountsFinishCreatingMutation:oA,usePostApiV1AccountsReselectUserMutation:rce,usePostApiV1AccountsCheckCaptchaMutation:iA}=eA;var sa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ss(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vg,xg,tl={exports:{}},Jn={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|