@wellesley/auth 1.0.180 → 1.0.183
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 CR,usePutApiV1AccountsResendEmailByHashMutation as IR,usePostApiV1AccountsAddReasonMutation as NR}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as Yo,handleBasicResponse as Ht,useGetApiV1SearchQuery as CR,usePutApiV1AccountsResendEmailByHashMutation as IR,usePostApiV1AccountsAddReasonMutation as NR}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.141";import{createSlice as xv}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.7";import{toast as zv}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{userSlice as oa,UserAvatar as qR}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.153";import*as Xc from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import Sv,{forwardRef as Ev,createElement as up,useCallback as wr,useEffect as We,useState as wt,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 OR,HoverCardTrigger as PR,HoverCardContent as DR,Switch as LR,Tooltip as gg,TooltipTrigger as mg,TooltipContent as kg,Textarea as MR,FormField as BR,FormItem as UR,FormLabel as $R,FormControl as GR,Input as wg,FormMessage as FR,Form as bn,ButtonLoader as qa}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.93";import{useAppsNavigate as Gr,AppsLink as Ra}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.80";import{logErrorToSentry as WR}from"https://cdn.jsdelivr.net/npm/@wellesley/sentry@1.0.14";import{get as fp,set as Qc,appendErrors as HR,useForm as vn}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as YR,rootReducer as VR}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.147";import{EmojiPicker as ZR,EmojiStyle as KR}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.7";import{useSearchParams as JR}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.14";const si=()=>"object"!=typeof window,jv=()=>Av()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),Tv=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},Rv=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),XR=(e,t)=>{const r=si()?"":document.cookie,a=`; ${t||r}`.split(`; ${e}=`);if(2===a.length)return(a.pop()||"").replace("=","").split(";").shift()},QR=(e,t)=>{si()||(document.cookie=Rv({[e]:"",path:"/",domain:t||jv(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},eA=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],Av=()=>eA.includes(location.hostname),tA=(e,t="",r=10,a)=>{si()||(document.cookie=Rv({[e]:t,path:"/",domain:a||jv(),expires:Tv(r),...!Av()&&{SameSite:"None",Secure:!0}}))},oi={set:tA,remove:QR,get:XR,getExpireDate:Tv},ii="auth_token",bg={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isAuthBlockVisible:!0,isPending:!1,isAuthenticated:!1},je=xv({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)),zv.error(Mp(t))}},rA=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,(()=>{zv.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:Cv,usePostApiV1AccountsPasswordRecoverCheckCodeMutation:Up,usePostApiV1AccountsPasswordRecoverChangeMutation:aA,usePostApiV1AccountsPasswordChangeConfirmMutation:Iv,usePostApiV1AccountsPasswordChangeRequestMutation:nA,usePutApiV1AccountsPasswordChangeResendCodeMutation:sA,usePostApiV1AccountsAuthenticateMutation:Nv,usePostApiV1AccountsEmailChangeRequestMutation:oA,usePostApiV1AccountsEmailChangeConfirmMutation:qv,usePostApiV1AccountsSignupMutation:$p,usePutApiV1AccountsResendEmailByHashMutation:sce,usePutApiV1AccountsEmailChangeResendCodeMutation:iA,usePostApiV1AccountsConfirmEmailMutation:Ov,usePostApiV1AccountsFinishCreatingMutation:cA,usePostApiV1AccountsReselectUserMutation:oce,usePostApiV1AccountsCheckCaptchaMutation:lA}=rA;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
|